diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/docs/.lock b/docs/.lock new file mode 100644 index 00000000..e69de29b diff --git a/docs/crates.js b/docs/crates.js new file mode 100644 index 00000000..5ee7b966 --- /dev/null +++ b/docs/crates.js @@ -0,0 +1 @@ +window.ALL_CRATES = ["pabi"]; \ No newline at end of file diff --git a/docs/help.html b/docs/help.html new file mode 100644 index 00000000..788144c5 --- /dev/null +++ b/docs/help.html @@ -0,0 +1,2 @@ +Help +

Rustdoc help

Back
\ No newline at end of file diff --git a/docs/pabi/all.html b/docs/pabi/all.html new file mode 100644 index 00000000..31060952 --- /dev/null +++ b/docs/pabi/all.html @@ -0,0 +1,2 @@ +List of all items in this crate +

List of all items

Structs

Enums

Traits

Functions

Type Aliases

Constants

\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.BISHOP_ATTACKS.html b/docs/pabi/chess/attacks/constant.BISHOP_ATTACKS.html new file mode 100644 index 00000000..0aba85dc --- /dev/null +++ b/docs/pabi/chess/attacks/constant.BISHOP_ATTACKS.html @@ -0,0 +1,2 @@ +BISHOP_ATTACKS in pabi::chess::attacks - Rust +

Constant pabi::chess::attacks::BISHOP_ATTACKS

source ·
const BISHOP_ATTACKS: [Bitboard; 5248];
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.BISHOP_ATTACKS_COUNT.html b/docs/pabi/chess/attacks/constant.BISHOP_ATTACKS_COUNT.html new file mode 100644 index 00000000..1e0687aa --- /dev/null +++ b/docs/pabi/chess/attacks/constant.BISHOP_ATTACKS_COUNT.html @@ -0,0 +1,2 @@ +BISHOP_ATTACKS_COUNT in pabi::chess::attacks - Rust +
const BISHOP_ATTACKS_COUNT: usize = 5248;
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.BISHOP_ATTACK_OFFSETS.html b/docs/pabi/chess/attacks/constant.BISHOP_ATTACK_OFFSETS.html new file mode 100644 index 00000000..e5bca7c7 --- /dev/null +++ b/docs/pabi/chess/attacks/constant.BISHOP_ATTACK_OFFSETS.html @@ -0,0 +1,2 @@ +BISHOP_ATTACK_OFFSETS in pabi::chess::attacks - Rust +
const BISHOP_ATTACK_OFFSETS: [usize; 64];
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.BISHOP_RAYS.html b/docs/pabi/chess/attacks/constant.BISHOP_RAYS.html new file mode 100644 index 00000000..f15d90c4 --- /dev/null +++ b/docs/pabi/chess/attacks/constant.BISHOP_RAYS.html @@ -0,0 +1,2 @@ +BISHOP_RAYS in pabi::chess::attacks - Rust +

Constant pabi::chess::attacks::BISHOP_RAYS

source ·
const BISHOP_RAYS: [Bitboard; 4096];
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.BISHOP_RELEVANT_OCCUPANCIES.html b/docs/pabi/chess/attacks/constant.BISHOP_RELEVANT_OCCUPANCIES.html new file mode 100644 index 00000000..de791312 --- /dev/null +++ b/docs/pabi/chess/attacks/constant.BISHOP_RELEVANT_OCCUPANCIES.html @@ -0,0 +1,2 @@ +BISHOP_RELEVANT_OCCUPANCIES in pabi::chess::attacks - Rust +
const BISHOP_RELEVANT_OCCUPANCIES: [u64; 64];
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.BLACK_LONG_CASTLE_KING_WALK.html b/docs/pabi/chess/attacks/constant.BLACK_LONG_CASTLE_KING_WALK.html new file mode 100644 index 00000000..da6d4cc5 --- /dev/null +++ b/docs/pabi/chess/attacks/constant.BLACK_LONG_CASTLE_KING_WALK.html @@ -0,0 +1,2 @@ +BLACK_LONG_CASTLE_KING_WALK in pabi::chess::attacks - Rust +
pub(super) const BLACK_LONG_CASTLE_KING_WALK: Bitboard;
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.BLACK_LONG_CASTLE_ROOK_WALK.html b/docs/pabi/chess/attacks/constant.BLACK_LONG_CASTLE_ROOK_WALK.html new file mode 100644 index 00000000..7f00a937 --- /dev/null +++ b/docs/pabi/chess/attacks/constant.BLACK_LONG_CASTLE_ROOK_WALK.html @@ -0,0 +1,2 @@ +BLACK_LONG_CASTLE_ROOK_WALK in pabi::chess::attacks - Rust +
pub(super) const BLACK_LONG_CASTLE_ROOK_WALK: Bitboard;
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.BLACK_PAWN_ATTACKS.html b/docs/pabi/chess/attacks/constant.BLACK_PAWN_ATTACKS.html new file mode 100644 index 00000000..068f09bd --- /dev/null +++ b/docs/pabi/chess/attacks/constant.BLACK_PAWN_ATTACKS.html @@ -0,0 +1,2 @@ +BLACK_PAWN_ATTACKS in pabi::chess::attacks - Rust +
const BLACK_PAWN_ATTACKS: [Bitboard; 64];
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.BLACK_SHORT_CASTLE_KING_WALK.html b/docs/pabi/chess/attacks/constant.BLACK_SHORT_CASTLE_KING_WALK.html new file mode 100644 index 00000000..c80b045c --- /dev/null +++ b/docs/pabi/chess/attacks/constant.BLACK_SHORT_CASTLE_KING_WALK.html @@ -0,0 +1,2 @@ +BLACK_SHORT_CASTLE_KING_WALK in pabi::chess::attacks - Rust +
pub(super) const BLACK_SHORT_CASTLE_KING_WALK: Bitboard;
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.BLACK_SHORT_CASTLE_ROOK_WALK.html b/docs/pabi/chess/attacks/constant.BLACK_SHORT_CASTLE_ROOK_WALK.html new file mode 100644 index 00000000..7b08205e --- /dev/null +++ b/docs/pabi/chess/attacks/constant.BLACK_SHORT_CASTLE_ROOK_WALK.html @@ -0,0 +1,2 @@ +BLACK_SHORT_CASTLE_ROOK_WALK in pabi::chess::attacks - Rust +
pub(super) const BLACK_SHORT_CASTLE_ROOK_WALK: Bitboard;
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.KING_ATTACKS.html b/docs/pabi/chess/attacks/constant.KING_ATTACKS.html new file mode 100644 index 00000000..c189ef39 --- /dev/null +++ b/docs/pabi/chess/attacks/constant.KING_ATTACKS.html @@ -0,0 +1,2 @@ +KING_ATTACKS in pabi::chess::attacks - Rust +

Constant pabi::chess::attacks::KING_ATTACKS

source ·
const KING_ATTACKS: [Bitboard; 64];
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.KNIGHT_ATTACKS.html b/docs/pabi/chess/attacks/constant.KNIGHT_ATTACKS.html new file mode 100644 index 00000000..ccbfa54c --- /dev/null +++ b/docs/pabi/chess/attacks/constant.KNIGHT_ATTACKS.html @@ -0,0 +1,2 @@ +KNIGHT_ATTACKS in pabi::chess::attacks - Rust +

Constant pabi::chess::attacks::KNIGHT_ATTACKS

source ·
const KNIGHT_ATTACKS: [Bitboard; 64];
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.RAYS.html b/docs/pabi/chess/attacks/constant.RAYS.html new file mode 100644 index 00000000..009333b1 --- /dev/null +++ b/docs/pabi/chess/attacks/constant.RAYS.html @@ -0,0 +1,2 @@ +RAYS in pabi::chess::attacks - Rust +

Constant pabi::chess::attacks::RAYS

source ·
const RAYS: [Bitboard; 4096];
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.ROOK_ATTACKS.html b/docs/pabi/chess/attacks/constant.ROOK_ATTACKS.html new file mode 100644 index 00000000..41321ed8 --- /dev/null +++ b/docs/pabi/chess/attacks/constant.ROOK_ATTACKS.html @@ -0,0 +1,2 @@ +ROOK_ATTACKS in pabi::chess::attacks - Rust +

Constant pabi::chess::attacks::ROOK_ATTACKS

source ·
const ROOK_ATTACKS: [Bitboard; 102400];
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.ROOK_ATTACKS_COUNT.html b/docs/pabi/chess/attacks/constant.ROOK_ATTACKS_COUNT.html new file mode 100644 index 00000000..0e72d1f7 --- /dev/null +++ b/docs/pabi/chess/attacks/constant.ROOK_ATTACKS_COUNT.html @@ -0,0 +1,2 @@ +ROOK_ATTACKS_COUNT in pabi::chess::attacks - Rust +
const ROOK_ATTACKS_COUNT: usize = 102_400;
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.ROOK_ATTACK_OFFSETS.html b/docs/pabi/chess/attacks/constant.ROOK_ATTACK_OFFSETS.html new file mode 100644 index 00000000..ef5918b8 --- /dev/null +++ b/docs/pabi/chess/attacks/constant.ROOK_ATTACK_OFFSETS.html @@ -0,0 +1,2 @@ +ROOK_ATTACK_OFFSETS in pabi::chess::attacks - Rust +
const ROOK_ATTACK_OFFSETS: [usize; 64];
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.ROOK_RAYS.html b/docs/pabi/chess/attacks/constant.ROOK_RAYS.html new file mode 100644 index 00000000..5bd2e23a --- /dev/null +++ b/docs/pabi/chess/attacks/constant.ROOK_RAYS.html @@ -0,0 +1,2 @@ +ROOK_RAYS in pabi::chess::attacks - Rust +

Constant pabi::chess::attacks::ROOK_RAYS

source ·
const ROOK_RAYS: [Bitboard; 4096];
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.ROOK_RELEVANT_OCCUPANCIES.html b/docs/pabi/chess/attacks/constant.ROOK_RELEVANT_OCCUPANCIES.html new file mode 100644 index 00000000..035617d0 --- /dev/null +++ b/docs/pabi/chess/attacks/constant.ROOK_RELEVANT_OCCUPANCIES.html @@ -0,0 +1,2 @@ +ROOK_RELEVANT_OCCUPANCIES in pabi::chess::attacks - Rust +
const ROOK_RELEVANT_OCCUPANCIES: [u64; 64];
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.WHITE_LONG_CASTLE_KING_WALK.html b/docs/pabi/chess/attacks/constant.WHITE_LONG_CASTLE_KING_WALK.html new file mode 100644 index 00000000..ac25d9cb --- /dev/null +++ b/docs/pabi/chess/attacks/constant.WHITE_LONG_CASTLE_KING_WALK.html @@ -0,0 +1,2 @@ +WHITE_LONG_CASTLE_KING_WALK in pabi::chess::attacks - Rust +
pub(super) const WHITE_LONG_CASTLE_KING_WALK: Bitboard;
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.WHITE_LONG_CASTLE_ROOK_WALK.html b/docs/pabi/chess/attacks/constant.WHITE_LONG_CASTLE_ROOK_WALK.html new file mode 100644 index 00000000..860f6e0e --- /dev/null +++ b/docs/pabi/chess/attacks/constant.WHITE_LONG_CASTLE_ROOK_WALK.html @@ -0,0 +1,2 @@ +WHITE_LONG_CASTLE_ROOK_WALK in pabi::chess::attacks - Rust +
pub(super) const WHITE_LONG_CASTLE_ROOK_WALK: Bitboard;
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.WHITE_PAWN_ATTACKS.html b/docs/pabi/chess/attacks/constant.WHITE_PAWN_ATTACKS.html new file mode 100644 index 00000000..f1c4aa51 --- /dev/null +++ b/docs/pabi/chess/attacks/constant.WHITE_PAWN_ATTACKS.html @@ -0,0 +1,2 @@ +WHITE_PAWN_ATTACKS in pabi::chess::attacks - Rust +
const WHITE_PAWN_ATTACKS: [Bitboard; 64];
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.WHITE_SHORT_CASTLE_KING_WALK.html b/docs/pabi/chess/attacks/constant.WHITE_SHORT_CASTLE_KING_WALK.html new file mode 100644 index 00000000..98042bf9 --- /dev/null +++ b/docs/pabi/chess/attacks/constant.WHITE_SHORT_CASTLE_KING_WALK.html @@ -0,0 +1,2 @@ +WHITE_SHORT_CASTLE_KING_WALK in pabi::chess::attacks - Rust +
pub(super) const WHITE_SHORT_CASTLE_KING_WALK: Bitboard;
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/constant.WHITE_SHORT_CASTLE_ROOK_WALK.html b/docs/pabi/chess/attacks/constant.WHITE_SHORT_CASTLE_ROOK_WALK.html new file mode 100644 index 00000000..cc8dec5b --- /dev/null +++ b/docs/pabi/chess/attacks/constant.WHITE_SHORT_CASTLE_ROOK_WALK.html @@ -0,0 +1,2 @@ +WHITE_SHORT_CASTLE_ROOK_WALK in pabi::chess::attacks - Rust +
pub(super) const WHITE_SHORT_CASTLE_ROOK_WALK: Bitboard;
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/fn.bishop_attacks.html b/docs/pabi/chess/attacks/fn.bishop_attacks.html new file mode 100644 index 00000000..01b6ddb6 --- /dev/null +++ b/docs/pabi/chess/attacks/fn.bishop_attacks.html @@ -0,0 +1,2 @@ +bishop_attacks in pabi::chess::attacks - Rust +

Function pabi::chess::attacks::bishop_attacks

source ·
pub(super) fn bishop_attacks(from: Square, occupancy: Bitboard) -> Bitboard
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/fn.bishop_ray.html b/docs/pabi/chess/attacks/fn.bishop_ray.html new file mode 100644 index 00000000..67a0b81f --- /dev/null +++ b/docs/pabi/chess/attacks/fn.bishop_ray.html @@ -0,0 +1,2 @@ +bishop_ray in pabi::chess::attacks - Rust +

Function pabi::chess::attacks::bishop_ray

source ·
pub(super) fn bishop_ray(from: Square, to: Square) -> Bitboard
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/fn.king_attacks.html b/docs/pabi/chess/attacks/fn.king_attacks.html new file mode 100644 index 00000000..16fa7ccc --- /dev/null +++ b/docs/pabi/chess/attacks/fn.king_attacks.html @@ -0,0 +1,2 @@ +king_attacks in pabi::chess::attacks - Rust +

Function pabi::chess::attacks::king_attacks

source ·
pub(super) fn king_attacks(from: Square) -> Bitboard
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/fn.knight_attacks.html b/docs/pabi/chess/attacks/fn.knight_attacks.html new file mode 100644 index 00000000..9676da46 --- /dev/null +++ b/docs/pabi/chess/attacks/fn.knight_attacks.html @@ -0,0 +1,2 @@ +knight_attacks in pabi::chess::attacks - Rust +

Function pabi::chess::attacks::knight_attacks

source ·
pub(super) fn knight_attacks(square: Square) -> Bitboard
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/fn.pawn_attacks.html b/docs/pabi/chess/attacks/fn.pawn_attacks.html new file mode 100644 index 00000000..cfa6397d --- /dev/null +++ b/docs/pabi/chess/attacks/fn.pawn_attacks.html @@ -0,0 +1,2 @@ +pawn_attacks in pabi::chess::attacks - Rust +

Function pabi::chess::attacks::pawn_attacks

source ·
pub(super) fn pawn_attacks(square: Square, player: Player) -> Bitboard
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/fn.pext.html b/docs/pabi/chess/attacks/fn.pext.html new file mode 100644 index 00000000..36c5e842 --- /dev/null +++ b/docs/pabi/chess/attacks/fn.pext.html @@ -0,0 +1,2 @@ +pext in pabi::chess::attacks - Rust +

Function pabi::chess::attacks::pext

source ·
fn pext(a: u64, mask: u64) -> u64
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/fn.queen_attacks.html b/docs/pabi/chess/attacks/fn.queen_attacks.html new file mode 100644 index 00000000..e2eae0ce --- /dev/null +++ b/docs/pabi/chess/attacks/fn.queen_attacks.html @@ -0,0 +1,2 @@ +queen_attacks in pabi::chess::attacks - Rust +

Function pabi::chess::attacks::queen_attacks

source ·
pub(super) fn queen_attacks(from: Square, occupancy: Bitboard) -> Bitboard
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/fn.ray.html b/docs/pabi/chess/attacks/fn.ray.html new file mode 100644 index 00000000..9892ae14 --- /dev/null +++ b/docs/pabi/chess/attacks/fn.ray.html @@ -0,0 +1,2 @@ +ray in pabi::chess::attacks - Rust +

Function pabi::chess::attacks::ray

source ·
pub(super) fn ray(from: Square, to: Square) -> Bitboard
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/fn.rook_attacks.html b/docs/pabi/chess/attacks/fn.rook_attacks.html new file mode 100644 index 00000000..063fbb1e --- /dev/null +++ b/docs/pabi/chess/attacks/fn.rook_attacks.html @@ -0,0 +1,2 @@ +rook_attacks in pabi::chess::attacks - Rust +

Function pabi::chess::attacks::rook_attacks

source ·
pub(super) fn rook_attacks(from: Square, occupancy: Bitboard) -> Bitboard
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/fn.rook_ray.html b/docs/pabi/chess/attacks/fn.rook_ray.html new file mode 100644 index 00000000..34f27753 --- /dev/null +++ b/docs/pabi/chess/attacks/fn.rook_ray.html @@ -0,0 +1,2 @@ +rook_ray in pabi::chess::attacks - Rust +

Function pabi::chess::attacks::rook_ray

source ·
fn rook_ray(from: Square, to: Square) -> Bitboard
\ No newline at end of file diff --git a/docs/pabi/chess/attacks/index.html b/docs/pabi/chess/attacks/index.html new file mode 100644 index 00000000..1d0211b5 --- /dev/null +++ b/docs/pabi/chess/attacks/index.html @@ -0,0 +1,5 @@ +pabi::chess::attacks - Rust +

Module pabi::chess::attacks

source ·
Expand description

Mappings of occupied squares to the attacked squares for each piece. The +mappings are pre-calculated where possible to provide an efficient way of +generating moves.

+

Structs§

Constants§

Functions§

\ No newline at end of file diff --git a/docs/pabi/chess/attacks/sidebar-items.js b/docs/pabi/chess/attacks/sidebar-items.js new file mode 100644 index 00000000..2c3ada6f --- /dev/null +++ b/docs/pabi/chess/attacks/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["BISHOP_ATTACKS","BISHOP_ATTACKS_COUNT","BISHOP_ATTACK_OFFSETS","BISHOP_RAYS","BISHOP_RELEVANT_OCCUPANCIES","BLACK_LONG_CASTLE_KING_WALK","BLACK_LONG_CASTLE_ROOK_WALK","BLACK_PAWN_ATTACKS","BLACK_SHORT_CASTLE_KING_WALK","BLACK_SHORT_CASTLE_ROOK_WALK","KING_ATTACKS","KNIGHT_ATTACKS","RAYS","ROOK_ATTACKS","ROOK_ATTACKS_COUNT","ROOK_ATTACK_OFFSETS","ROOK_RAYS","ROOK_RELEVANT_OCCUPANCIES","WHITE_LONG_CASTLE_KING_WALK","WHITE_LONG_CASTLE_ROOK_WALK","WHITE_PAWN_ATTACKS","WHITE_SHORT_CASTLE_KING_WALK","WHITE_SHORT_CASTLE_ROOK_WALK"],"fn":["bishop_attacks","bishop_ray","king_attacks","knight_attacks","pawn_attacks","pext","queen_attacks","ray","rook_attacks","rook_ray"],"struct":["AttackInfo"]}; \ No newline at end of file diff --git a/docs/pabi/chess/attacks/struct.AttackInfo.html b/docs/pabi/chess/attacks/struct.AttackInfo.html new file mode 100644 index 00000000..0b9961a1 --- /dev/null +++ b/docs/pabi/chess/attacks/struct.AttackInfo.html @@ -0,0 +1,31 @@ +AttackInfo in pabi::chess::attacks - Rust +

Struct pabi::chess::attacks::AttackInfo

source ·
pub(super) struct AttackInfo {
+    pub(super) attacks: Bitboard,
+    pub(super) checkers: Bitboard,
+    pub(super) pins: Bitboard,
+    pub(super) xrays: Bitboard,
+    pub(super) safe_king_squares: Bitboard,
+}

Fields§

§attacks: Bitboard§checkers: Bitboard§pins: Bitboard§xrays: Bitboard§safe_king_squares: Bitboard

Implementations§

source§

impl AttackInfo

source

pub(super) fn new( + they: Player, + their: &Pieces, + king: Square, + our_occupancy: Bitboard, + occupancy: Bitboard +) -> Self

Trait Implementations§

source§

impl Debug for AttackInfo

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/bitboard/constant.LINE_SEPARATOR.html b/docs/pabi/chess/bitboard/constant.LINE_SEPARATOR.html new file mode 100644 index 00000000..d1f746a1 --- /dev/null +++ b/docs/pabi/chess/bitboard/constant.LINE_SEPARATOR.html @@ -0,0 +1,2 @@ +LINE_SEPARATOR in pabi::chess::bitboard - Rust +
const LINE_SEPARATOR: &str = "\n";
\ No newline at end of file diff --git a/docs/pabi/chess/bitboard/constant.SQUARE_SEPARATOR.html b/docs/pabi/chess/bitboard/constant.SQUARE_SEPARATOR.html new file mode 100644 index 00000000..a3f1059d --- /dev/null +++ b/docs/pabi/chess/bitboard/constant.SQUARE_SEPARATOR.html @@ -0,0 +1,2 @@ +SQUARE_SEPARATOR in pabi::chess::bitboard - Rust +
const SQUARE_SEPARATOR: &str = " ";
\ No newline at end of file diff --git a/docs/pabi/chess/bitboard/index.html b/docs/pabi/chess/bitboard/index.html new file mode 100644 index 00000000..3efb57cd --- /dev/null +++ b/docs/pabi/chess/bitboard/index.html @@ -0,0 +1,24 @@ +pabi::chess::bitboard - Rust +

Module pabi::chess::bitboard

source ·
Expand description

Bitboard-based representation for crate::chess::position::Position. +Bitboards utilize the fact that modern processors operate on 64 bit +integers, and the bit operations can be performed simultaneously. This +results in very efficient calculation of possible attack vectors and other +meaningful features that are required to calculate possible moves and +evaluate position. The disadvantage is complexity that comes with bitboard +implementation and inefficiency of some operations like “get piece type on +given square” (efficiently handled by Square-centric board implementations +that can be used together bitboard-based approach to compensate its +shortcomings).

+

Structs§

  • Represents a set of squares and provides common operations (e.g. AND, OR, +XOR) over these sets. Each bit corresponds to one of 64 squares of the chess +board.
  • Iterates over set squares in a given Bitboard from least significant 1 +bits (LS1B) to most significant 1 bits (MS1B) through implementing +bitscan forward operation.
  • Board 🔒
    Piece-centric implementation of the chess board. This is the “back-end” of +the chess engine, an efficient board representation is crucial for +performance. An alternative implementation would be Square-Piece table but +both have different trade-offs and scenarios where they are efficient. It is +likely that the best overall performance can be achieved by keeping both to +complement each other.
  • Pieces 🔒
    Piece-centric representation of all material owned by one player. Uses +Bitboard to store a set of squares occupied by each piece. The main user +is crate::chess::position::Position, Bitboard is not very useful on +its own.

Constants§

\ No newline at end of file diff --git a/docs/pabi/chess/bitboard/sidebar-items.js b/docs/pabi/chess/bitboard/sidebar-items.js new file mode 100644 index 00000000..32f8dc03 --- /dev/null +++ b/docs/pabi/chess/bitboard/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["LINE_SEPARATOR","SQUARE_SEPARATOR"],"struct":["Bitboard","BitboardIterator","Board","Pieces"]}; \ No newline at end of file diff --git a/docs/pabi/chess/bitboard/struct.Bitboard.html b/docs/pabi/chess/bitboard/struct.Bitboard.html new file mode 100644 index 00000000..71ebf8c6 --- /dev/null +++ b/docs/pabi/chess/bitboard/struct.Bitboard.html @@ -0,0 +1,45 @@ +Bitboard in pabi::chess::bitboard - Rust +

Struct pabi::chess::bitboard::Bitboard

source ·
pub struct Bitboard {
+    bits: u64,
+}
Expand description

Represents a set of squares and provides common operations (e.g. AND, OR, +XOR) over these sets. Each bit corresponds to one of 64 squares of the chess +board.

+

Mirroring Square semantics, the least significant +bit corresponds to A1, and the most significant bit - to H8.

+

Bitboard is a thin wrapper around u64.

+

Fields§

§bits: u64

Implementations§

source§

impl Bitboard

source

pub(super) const fn from_bits(bits: u64) -> Self

Constructs Bitboard from pre-calculated bits.

+
source

pub const fn empty() -> Self

Constructs a bitboard representing empty set of squares.

+
source

pub const fn full() -> Self

Constructs a bitboard representing the universal set, it contains all +squares by setting all bits to binary one.

+
source

pub const fn bits(self) -> u64

Returns raw bits.

+
source

pub(super) fn from_squares(squares: &[Square]) -> Self

source

pub(super) fn extend(&mut self, square: Square)

Adds given square to the set.

+
source

pub(super) fn clear(&mut self, square: Square)

Adds given square to the set.

+
source

pub(super) fn contains(self, square: Square) -> bool

Returns true if this bitboard contains given square.

+
source

pub(super) fn as_square(self) -> Square

source

pub(super) fn count(self) -> u32

source

pub(super) fn is_empty(self) -> bool

source

pub(super) fn has_any(self) -> bool

source

pub(super) fn shift(self, direction: Direction) -> Self

source

pub(super) fn iter(self) -> BitboardIterator

An efficient way to iterate over the set squares.

+

Trait Implementations§

source§

impl BitAnd for Bitboard

§

type Output = Bitboard

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
source§

impl BitAndAssign for Bitboard

source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation. Read more
source§

impl BitOr for Bitboard

§

type Output = Bitboard

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
source§

impl BitOrAssign for Bitboard

source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
source§

impl BitXor for Bitboard

§

type Output = Bitboard

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Self) -> Self::Output

Performs the ^ operation. Read more
source§

impl Clone for Bitboard

source§

fn clone(&self) -> Bitboard

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Bitboard

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Square> for Bitboard

source§

fn from(square: Square) -> Self

Converts to this type from the input type.
source§

impl Not for Bitboard

source§

fn not(self) -> Self::Output

Returns complement +set of Self, +i.e. flipping the set squares to unset and vice versa.

+
§

type Output = Bitboard

The resulting type after applying the ! operator.
source§

impl PartialEq for Bitboard

source§

fn eq(&self, other: &Bitboard) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Shl<u32> for Bitboard

source§

fn shl(self, rhs: u32) -> Self::Output

Shifts the bits to the left and ignores overflow.

+
§

type Output = Bitboard

The resulting type after applying the << operator.
source§

impl Shr<u32> for Bitboard

source§

fn shr(self, rhs: u32) -> Self::Output

Shifts the bits to the right and ignores overflow.

+
§

type Output = Bitboard

The resulting type after applying the >> operator.
source§

impl Sub for Bitboard

source§

fn sub(self, rhs: Self) -> Self::Output

Relative component, i.e. Result = LHS \ RHS.

+
§

type Output = Bitboard

The resulting type after applying the - operator.
source§

impl SubAssign for Bitboard

source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
source§

impl TryInto<Square> for Bitboard

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<Square>

Performs the conversion.
source§

impl Copy for Bitboard

source§

impl Eq for Bitboard

source§

impl StructuralPartialEq for Bitboard

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/bitboard/struct.BitboardIterator.html b/docs/pabi/chess/bitboard/struct.BitboardIterator.html new file mode 100644 index 00000000..253729a2 --- /dev/null +++ b/docs/pabi/chess/bitboard/struct.BitboardIterator.html @@ -0,0 +1,616 @@ +BitboardIterator in pabi::chess::bitboard - Rust +
pub(super) struct BitboardIterator {
+    bits: u64,
+}
Expand description

Iterates over set squares in a given Bitboard from least significant 1 +bits (LS1B) to most significant 1 bits (MS1B) through implementing +bitscan forward operation.

+

Fields§

§bits: u64

Trait Implementations§

source§

impl ExactSizeIterator for BitboardIterator

source§

fn len(&self) -> usize

Returns the exact remaining length of the iterator. Read more
source§

fn is_empty(&self) -> bool

🔬This is a nightly-only experimental API. (exact_size_is_empty)
Returns true if the iterator is empty. Read more
source§

impl Iterator for BitboardIterator

§

type Item = Square

The type of the elements being iterated over.
source§

fn next(&mut self) -> Option<Self::Item>

Advances the iterator and returns the next value. Read more
source§

fn next_chunk<const N: usize>( + &mut self +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
1.0.0 · source§

fn count(self) -> usize
where + Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 · source§

fn last(self) -> Option<Self::Item>
where + Self: Sized,

Consumes the iterator, returning the last element. Read more
source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.0.0 · source§

fn nth(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element of the iterator. Read more
1.28.0 · source§

fn step_by(self, step: usize) -> StepBy<Self>
where + Self: Sized,

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
1.0.0 · source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where + Self: Sized, + Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more
source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where + Self: Sized, + G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
1.0.0 · source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each +element. Read more
1.21.0 · source§

fn for_each<F>(self, f: F)
where + Self: Sized, + F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
1.0.0 · source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · source§

fn enumerate(self) -> Enumerate<Self>
where + Self: Sized,

Creates an iterator which gives the current iteration count as well as +the next value. Read more
1.0.0 · source§

fn peekable(self) -> Peekable<Self>
where + Self: Sized,

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more
1.0.0 · source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · source§

fn skip(self, n: usize) -> Skip<Self>
where + Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · source§

fn take(self, n: usize) -> Take<Self>
where + Self: Sized,

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
1.0.0 · source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
1.0.0 · source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where + Self: Sized, + F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over +self and returns an iterator over the outputs of f. Like slice::windows(), +the windows during mapping overlap as well. Read more
1.0.0 · source§

fn fuse(self) -> Fuse<Self>
where + Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · source§

fn by_ref(&mut self) -> &mut Self
where + Self: Sized,

Borrows an iterator, rather than consuming it. Read more
1.0.0 · source§

fn collect<B>(self) -> B
where + B: FromIterator<Self::Item>, + Self: Sized,

Transforms an iterator into a collection. Read more
source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where + E: Extend<Self::Item>, + Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · source§

fn partition<B, F>(self, f: F) -> (B, B)
where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
source§

fn is_partitioned<P>(self, predicate: P) -> bool
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
1.27.0 · source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
1.27.0 · source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
1.0.0 · source§

fn fold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, +returning the final result. Read more
1.51.0 · source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
source§

fn try_reduce<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> R, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · source§

fn all<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · source§

fn any<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns +the first non-none result. Read more
source§

fn try_find<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where + Self: Sized, + F: FnMut(&Self::Item) -> R, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
1.0.0 · source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.0.0 · source§

fn max(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the maximum element of an iterator. Read more
1.0.0 · source§

fn min(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the minimum element of an iterator. Read more
1.6.0 · source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the +specified function. Read more
1.15.0 · source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
1.6.0 · source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the +specified function. Read more
1.15.0 · source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
1.0.0 · source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · source§

fn copied<'a, T>(self) -> Copied<Self>
where + T: 'a + Copy, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · source§

fn cloned<'a, T>(self) -> Cloned<Self>
where + T: 'a + Clone, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · source§

fn sum<S>(self) -> S
where + Self: Sized, + S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · source§

fn product<P>(self) -> P
where + Self: Sized, + P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
1.5.0 · source§

fn cmp<I>(self, other: I) -> Ordering
where + I: IntoIterator<Item = Self::Item>, + Self::Item: Ord, + Self: Sized,

Lexicographically compares the elements of this Iterator with those +of another. Read more
source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · source§

fn eq<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are equal to those of +another. Read more
source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
1.5.0 · source§

fn ne<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are not equal to those of +another. Read more
1.5.0 · source§

fn lt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
1.5.0 · source§

fn le<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
1.5.0 · source§

fn gt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
1.5.0 · source§

fn ge<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
source§

fn is_sorted(self) -> bool
where + Self: Sized, + Self::Item: PartialOrd,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted. Read more
source§

fn is_sorted_by<F>(self, compare: F) -> bool
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> bool,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given comparator function. Read more
source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

impl<I> IntoIterator for I
where + I: Iterator,

§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
§

type IntoIter = I

Which kind of iterator are we turning this into?
const: unstable · source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
§

impl<T> Itertools for T
where + T: Iterator + ?Sized,

§

fn interleave<J>( + self, + other: J +) -> Interleave<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator<Item = Self::Item>, + Self: Sized,

Alternate elements from two iterators until both have run out. Read more
§

fn interleave_shortest<J>( + self, + other: J +) -> InterleaveShortest<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator<Item = Self::Item>, + Self: Sized,

Alternate elements from two iterators until at least one of them has run +out. Read more
§

fn intersperse( + self, + element: Self::Item +) -> IntersperseWith<Self, IntersperseElementSimple<Self::Item>>
where + Self: Sized, + Self::Item: Clone,

An iterator adaptor to insert a particular value +between each element of the adapted iterator. Read more
§

fn intersperse_with<F>(self, element: F) -> IntersperseWith<Self, F>
where + Self: Sized, + F: FnMut() -> Self::Item,

An iterator adaptor to insert a particular value created by a function +between each element of the adapted iterator. Read more
§

fn zip_longest<J>( + self, + other: J +) -> ZipLongest<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator, + Self: Sized,

Create an iterator which iterates over both this and the specified +iterator simultaneously, yielding pairs of two optional elements. Read more
§

fn zip_eq<J>(self, other: J) -> ZipEq<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator, + Self: Sized,

Create an iterator which iterates over both this and the specified +iterator simultaneously, yielding pairs of elements. Read more
§

fn batching<B, F>(self, f: F) -> Batching<Self, F>
where + F: FnMut(&mut Self) -> Option<B>, + Self: Sized,

A “meta iterator adaptor”. Its closure receives a reference to the +iterator and may pick off as many elements as it likes, to produce the +next iterator element. Read more
§

fn group_by<K, F>(self, key: F) -> GroupBy<K, Self, F>
where + Self: Sized, + F: FnMut(&Self::Item) -> K, + K: PartialEq,

Return an iterable that can group iterator elements. +Consecutive elements that map to the same key (“runs”), are assigned +to the same group. Read more
§

fn chunks(self, size: usize) -> IntoChunks<Self>
where + Self: Sized,

Return an iterable that can chunk the iterator. Read more
§

fn tuple_windows<T>(self) -> TupleWindows<Self, T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple, + <T as TupleCollect>::Item: Clone,

Return an iterator over all contiguous windows producing tuples of +a specific size (up to 12). Read more
§

fn circular_tuple_windows<T>(self) -> CircularTupleWindows<Self, T>
where + Self: Sized + Clone + Iterator<Item = <T as TupleCollect>::Item> + ExactSizeIterator, + T: TupleCollect + Clone, + <T as TupleCollect>::Item: Clone,

Return an iterator over all windows, wrapping back to the first +elements when the window would otherwise exceed the length of the +iterator, producing tuples of a specific size (up to 12). Read more
§

fn tuples<T>(self) -> Tuples<Self, T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple,

Return an iterator that groups the items in tuples of a specific size +(up to 12). Read more
§

fn tee(self) -> (Tee<Self>, Tee<Self>)
where + Self: Sized, + Self::Item: Clone,

Split into an iterator pair that both yield all elements from +the original iterator. Read more
§

fn step(self, n: usize) -> Step<Self>
where + Self: Sized,

👎Deprecated since 0.8.0: Use std .step_by() instead
Return an iterator adaptor that steps n elements in the base iterator +for each iteration. Read more
§

fn map_into<R>(self) -> MapSpecialCase<Self, MapSpecialCaseFnInto<R>>
where + Self: Sized, + Self::Item: Into<R>,

Convert each item of the iterator using the Into trait. Read more
§

fn map_results<F, T, U, E>( + self, + f: F +) -> MapSpecialCase<Self, MapSpecialCaseFnOk<F>>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(T) -> U,

👎Deprecated since 0.10.0: Use .map_ok() instead
§

fn map_ok<F, T, U, E>(self, f: F) -> MapSpecialCase<Self, MapSpecialCaseFnOk<F>>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(T) -> U,

Return an iterator adaptor that applies the provided closure +to every Result::Ok value. Result::Err values are +unchanged. Read more
§

fn filter_ok<F, T, E>(self, f: F) -> FilterOk<Self, F>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(&T) -> bool,

Return an iterator adaptor that filters every Result::Ok +value with the provided closure. Result::Err values are +unchanged. Read more
§

fn filter_map_ok<F, T, U, E>(self, f: F) -> FilterMapOk<Self, F>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(T) -> Option<U>,

Return an iterator adaptor that filters and transforms every +Result::Ok value with the provided closure. Result::Err +values are unchanged. Read more
§

fn flatten_ok<T, E>(self) -> FlattenOk<Self, T, E>
where + Self: Sized + Iterator<Item = Result<T, E>>, + T: IntoIterator,

Return an iterator adaptor that flattens every Result::Ok value into +a series of Result::Ok values. Result::Err values are unchanged. Read more
§

fn process_results<F, T, E, R>(self, processor: F) -> Result<R, E>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnOnce(ProcessResults<'_, Self, E>) -> R,

“Lift” a function of the values of the current iterator so as to process +an iterator of Result values instead. Read more
§

fn merge<J>( + self, + other: J +) -> MergeBy<Self, <J as IntoIterator>::IntoIter, MergeLte>
where + Self: Sized, + Self::Item: PartialOrd, + J: IntoIterator<Item = Self::Item>,

Return an iterator adaptor that merges the two base iterators in +ascending order. If both base iterators are sorted (ascending), the +result is sorted. Read more
§

fn merge_by<J, F>( + self, + other: J, + is_first: F +) -> MergeBy<Self, <J as IntoIterator>::IntoIter, F>
where + Self: Sized, + J: IntoIterator<Item = Self::Item>, + F: FnMut(&Self::Item, &Self::Item) -> bool,

Return an iterator adaptor that merges the two base iterators in order. +This is much like .merge() but allows for a custom ordering. Read more
§

fn merge_join_by<J, F, T>( + self, + other: J, + cmp_fn: F +) -> MergeBy<Self, <J as IntoIterator>::IntoIter, MergeFuncLR<F, <F as FuncLR<Self::Item, <<J as IntoIterator>::IntoIter as Iterator>::Item>>::T>>
where + J: IntoIterator, + F: FnMut(&Self::Item, &<J as IntoIterator>::Item) -> T, + Self: Sized,

Create an iterator that merges items from both this and the specified +iterator in ascending order. Read more
§

fn kmerge(self) -> KMergeBy<<Self::Item as IntoIterator>::IntoIter, KMergeByLt>
where + Self: Sized, + Self::Item: IntoIterator, + <Self::Item as IntoIterator>::Item: PartialOrd,

Return an iterator adaptor that flattens an iterator of iterators by +merging them in ascending order. Read more
§

fn kmerge_by<F>( + self, + first: F +) -> KMergeBy<<Self::Item as IntoIterator>::IntoIter, F>
where + Self: Sized, + Self::Item: IntoIterator, + F: FnMut(&<Self::Item as IntoIterator>::Item, &<Self::Item as IntoIterator>::Item) -> bool,

Return an iterator adaptor that flattens an iterator of iterators by +merging them according to the given closure. Read more
§

fn cartesian_product<J>( + self, + other: J +) -> Product<Self, <J as IntoIterator>::IntoIter>
where + Self: Sized, + Self::Item: Clone, + J: IntoIterator, + <J as IntoIterator>::IntoIter: Clone,

Return an iterator adaptor that iterates over the cartesian product of +the element sets of two iterators self and J. Read more
§

fn multi_cartesian_product( + self +) -> MultiProduct<<Self::Item as IntoIterator>::IntoIter>
where + Self: Sized, + Self::Item: IntoIterator, + <Self::Item as IntoIterator>::IntoIter: Clone, + <Self::Item as IntoIterator>::Item: Clone,

Return an iterator adaptor that iterates over the cartesian product of +all subiterators returned by meta-iterator self. Read more
§

fn coalesce<F>(self, f: F) -> CoalesceBy<Self, F, NoCount>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Result<Self::Item, (Self::Item, Self::Item)>,

Return an iterator adaptor that uses the passed-in closure to +optionally merge together consecutive elements. Read more
§

fn dedup(self) -> CoalesceBy<Self, DedupPred2CoalescePred<DedupEq>, NoCount>
where + Self: Sized, + Self::Item: PartialEq,

Remove duplicates from sections of consecutive identical elements. +If the iterator is sorted, all elements will be unique. Read more
§

fn dedup_by<Cmp>( + self, + cmp: Cmp +) -> CoalesceBy<Self, DedupPred2CoalescePred<Cmp>, NoCount>
where + Self: Sized, + Cmp: FnMut(&Self::Item, &Self::Item) -> bool,

Remove duplicates from sections of consecutive identical elements, +determining equality using a comparison function. +If the iterator is sorted, all elements will be unique. Read more
§

fn dedup_with_count( + self +) -> CoalesceBy<Self, DedupPredWithCount2CoalescePred<DedupEq>, WithCount>
where + Self: Sized,

Remove duplicates from sections of consecutive identical elements, while keeping a count of +how many repeated elements were present. +If the iterator is sorted, all elements will be unique. Read more
§

fn dedup_by_with_count<Cmp>( + self, + cmp: Cmp +) -> CoalesceBy<Self, DedupPredWithCount2CoalescePred<Cmp>, WithCount>
where + Self: Sized, + Cmp: FnMut(&Self::Item, &Self::Item) -> bool,

Remove duplicates from sections of consecutive identical elements, while keeping a count of +how many repeated elements were present. +This will determine equality using a comparison function. +If the iterator is sorted, all elements will be unique. Read more
§

fn duplicates(self) -> DuplicatesBy<Self, Self::Item, ById>
where + Self: Sized, + Self::Item: Eq + Hash,

Return an iterator adaptor that produces elements that appear more than once during the +iteration. Duplicates are detected using hash and equality. Read more
§

fn duplicates_by<V, F>(self, f: F) -> DuplicatesBy<Self, V, ByFn<F>>
where + Self: Sized, + V: Eq + Hash, + F: FnMut(&Self::Item) -> V,

Return an iterator adaptor that produces elements that appear more than once during the +iteration. Duplicates are detected using hash and equality. Read more
§

fn unique(self) -> Unique<Self>
where + Self: Sized, + Self::Item: Clone + Eq + Hash,

Return an iterator adaptor that filters out elements that have +already been produced once during the iteration. Duplicates +are detected using hash and equality. Read more
§

fn unique_by<V, F>(self, f: F) -> UniqueBy<Self, V, F>
where + Self: Sized, + V: Eq + Hash, + F: FnMut(&Self::Item) -> V,

Return an iterator adaptor that filters out elements that have +already been produced once during the iteration. Read more
§

fn peeking_take_while<F>(&mut self, accept: F) -> PeekingTakeWhile<'_, Self, F>
where + Self: Sized + PeekingNext, + F: FnMut(&Self::Item) -> bool,

Return an iterator adaptor that borrows from this iterator and +takes items while the closure accept returns true. Read more
§

fn take_while_ref<F>(&mut self, accept: F) -> TakeWhileRef<'_, Self, F>
where + Self: Clone, + F: FnMut(&Self::Item) -> bool,

Return an iterator adaptor that borrows from a Clone-able iterator +to only pick off elements while the predicate accept returns true. Read more
§

fn take_while_inclusive<F>(self, accept: F) -> TakeWhileInclusive<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item) -> bool,

Returns an iterator adaptor that consumes elements while the given +predicate is true, including the element for which the predicate +first returned false. Read more
§

fn while_some<A>(self) -> WhileSome<Self>
where + Self: Sized + Iterator<Item = Option<A>>,

Return an iterator adaptor that filters Option<A> iterator elements +and produces A. Stops on the first None encountered. Read more
§

fn tuple_combinations<T>(self) -> TupleCombinations<Self, T>
where + Self: Sized + Clone, + Self::Item: Clone, + T: HasCombination<Self>,

Return an iterator adaptor that iterates over the combinations of the +elements from an iterator. Read more
§

fn combinations(self, k: usize) -> Combinations<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator adaptor that iterates over the k-length combinations of +the elements from an iterator. Read more
§

fn combinations_with_replacement( + self, + k: usize +) -> CombinationsWithReplacement<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator that iterates over the k-length combinations of +the elements from an iterator, with replacement. Read more
§

fn permutations(self, k: usize) -> Permutations<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator adaptor that iterates over all k-permutations of the +elements from an iterator. Read more
§

fn powerset(self) -> Powerset<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator that iterates through the powerset of the elements from an +iterator. Read more
§

fn pad_using<F>(self, min: usize, f: F) -> PadUsing<Self, F>
where + Self: Sized, + F: FnMut(usize) -> Self::Item,

Return an iterator adaptor that pads the sequence to a minimum length of +min by filling missing elements using a closure f. Read more
§

fn with_position(self) -> WithPosition<Self>
where + Self: Sized,

Return an iterator adaptor that combines each element with a Position to +ease special-case handling of the first or last elements. Read more
§

fn positions<P>(self, predicate: P) -> Positions<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Return an iterator adaptor that yields the indices of all elements +satisfying a predicate, counted from the start of the iterator. Read more
§

fn update<F>(self, updater: F) -> Update<Self, F>
where + Self: Sized, + F: FnMut(&mut Self::Item),

Return an iterator adaptor that applies a mutating function +to each element before yielding it. Read more
§

fn next_tuple<T>(&mut self) -> Option<T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple,

Advances the iterator and returns the next items grouped in a tuple of +a specific size (up to 12). Read more
§

fn collect_tuple<T>(self) -> Option<T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple,

Collects all items from the iterator into a tuple of a specific size +(up to 12). Read more
§

fn find_position<P>(&mut self, pred: P) -> Option<(usize, Self::Item)>
where + P: FnMut(&Self::Item) -> bool,

Find the position and value of the first element satisfying a predicate. Read more
§

fn find_or_last<P>(self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Find the value of the first element satisfying a predicate or return the last element, if any. Read more
§

fn find_or_first<P>(self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Find the value of the first element satisfying a predicate or return the first element, if any. Read more
§

fn contains<Q>(&mut self, query: &Q) -> bool
where + Self: Sized, + Self::Item: Borrow<Q>, + Q: PartialEq,

Returns true if the given item is present in this iterator. Read more
§

fn all_equal(&mut self) -> bool
where + Self: Sized, + Self::Item: PartialEq,

Check whether all elements compare equal. Read more
§

fn all_equal_value( + &mut self +) -> Result<Self::Item, Option<(Self::Item, Self::Item)>>
where + Self: Sized, + Self::Item: PartialEq,

If there are elements and they are all equal, return a single copy of that element. +If there are no elements, return an Error containing None. +If there are elements and they are not all equal, return a tuple containing the first +two non-equal elements found. Read more
§

fn all_unique(&mut self) -> bool
where + Self: Sized, + Self::Item: Eq + Hash,

Check whether all elements are unique (non equal). Read more
§

fn dropping(self, n: usize) -> Self
where + Self: Sized,

Consume the first n elements from the iterator eagerly, +and return the same iterator again. Read more
§

fn dropping_back(self, n: usize) -> Self
where + Self: Sized + DoubleEndedIterator,

Consume the last n elements from the iterator eagerly, +and return the same iterator again. Read more
§

fn foreach<F>(self, f: F)
where + F: FnMut(Self::Item), + Self: Sized,

👎Deprecated since 0.8.0: Use .for_each() instead
Run the closure f eagerly on each element of the iterator. Read more
§

fn concat(self) -> Self::Item
where + Self: Sized, + Self::Item: Extend<<Self::Item as IntoIterator>::Item> + IntoIterator + Default,

Combine all an iterator’s elements into one element by using Extend. Read more
§

fn collect_vec(self) -> Vec<Self::Item>
where + Self: Sized,

.collect_vec() is simply a type specialization of Iterator::collect, +for convenience.
§

fn try_collect<T, U, E>(self) -> Result<U, E>
where + Self: Sized + Iterator<Item = Result<T, E>>, + Result<U, E>: FromIterator<Result<T, E>>,

.try_collect() is more convenient way of writing +.collect::<Result<_, _>>() Read more
§

fn set_from<'a, A, J>(&mut self, from: J) -> usize
where + A: 'a, + Self: Iterator<Item = &'a mut A>, + J: IntoIterator<Item = A>,

Assign to each reference in self from the from iterator, +stopping at the shortest of the two iterators. Read more
§

fn join(&mut self, sep: &str) -> String
where + Self::Item: Display,

Combine all iterator elements into one String, separated by sep. Read more
§

fn format(self, sep: &str) -> Format<'_, Self>
where + Self: Sized,

Format all iterator elements, separated by sep. Read more
§

fn format_with<F>(self, sep: &str, format: F) -> FormatWith<'_, Self, F>
where + Self: Sized, + F: FnMut(Self::Item, &mut dyn FnMut(&dyn Display) -> Result<(), Error>) -> Result<(), Error>,

Format all iterator elements, separated by sep. Read more
§

fn fold_results<A, E, B, F>(&mut self, start: B, f: F) -> Result<B, E>
where + Self: Iterator<Item = Result<A, E>>, + F: FnMut(B, A) -> B,

👎Deprecated since 0.10.0: Use .fold_ok() instead
§

fn fold_ok<A, E, B, F>(&mut self, start: B, f: F) -> Result<B, E>
where + Self: Iterator<Item = Result<A, E>>, + F: FnMut(B, A) -> B,

Fold Result values from an iterator. Read more
§

fn fold_options<A, B, F>(&mut self, start: B, f: F) -> Option<B>
where + Self: Iterator<Item = Option<A>>, + F: FnMut(B, A) -> B,

Fold Option values from an iterator. Read more
§

fn fold1<F>(self, f: F) -> Option<Self::Item>
where + F: FnMut(Self::Item, Self::Item) -> Self::Item, + Self: Sized,

👎Deprecated since 0.10.2: Use Iterator::reduce instead
Accumulator of the elements in the iterator. Read more
§

fn tree_fold1<F>(self, f: F) -> Option<Self::Item>
where + F: FnMut(Self::Item, Self::Item) -> Self::Item, + Self: Sized,

Accumulate the elements in the iterator in a tree-like manner. Read more
§

fn fold_while<B, F>(&mut self, init: B, f: F) -> FoldWhile<B>
where + Self: Sized, + F: FnMut(B, Self::Item) -> FoldWhile<B>,

An iterator method that applies a function, producing a single, final value. Read more
§

fn sum1<S>(self) -> Option<S>
where + Self: Sized, + S: Sum<Self::Item>,

Iterate over the entire iterator and add all the elements. Read more
§

fn product1<P>(self) -> Option<P>
where + Self: Sized, + P: Product<Self::Item>,

Iterate over the entire iterator and multiply all the elements. Read more
§

fn sorted_unstable(self) -> IntoIter<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_unstable_by<F>(self, cmp: F) -> IntoIter<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_unstable_by_key<K, F>(self, f: F) -> IntoIter<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted(self) -> IntoIter<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_by<F>(self, cmp: F) -> IntoIter<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_by_key<K, F>(self, f: F) -> IntoIter<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_by_cached_key<K, F>(self, f: F) -> IntoIter<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Sort all iterator elements into a new iterator in ascending order. The key function is +called exactly once per key. Read more
§

fn k_smallest(self, k: usize) -> IntoIter<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Sort the k smallest elements into a new iterator, in ascending order. Read more
§

fn partition_map<A, B, F, L, R>(self, predicate: F) -> (A, B)
where + Self: Sized, + F: FnMut(Self::Item) -> Either<L, R>, + A: Default + Extend<L>, + B: Default + Extend<R>,

Collect all iterator elements into one of two +partitions. Unlike Iterator::partition, each partition may +have a distinct type. Read more
§

fn partition_result<A, B, T, E>(self) -> (A, B)
where + Self: Sized + Iterator<Item = Result<T, E>>, + A: Default + Extend<T>, + B: Default + Extend<E>,

Partition a sequence of Results into one list of all the Ok elements +and another list of all the Err elements. Read more
§

fn into_group_map<K, V>(self) -> HashMap<K, Vec<V>>
where + Self: Sized + Iterator<Item = (K, V)>, + K: Hash + Eq,

Return a HashMap of keys mapped to Vecs of values. Keys and values +are taken from (Key, Value) tuple pairs yielded by the input iterator. Read more
§

fn into_group_map_by<K, V, F>(self, f: F) -> HashMap<K, Vec<V>>
where + Self: Sized + Iterator<Item = V>, + K: Hash + Eq, + F: Fn(&V) -> K,

Return an Iterator on a HashMap. Keys mapped to Vecs of values. The key is specified +in the closure. Read more
§

fn into_grouping_map<K, V>(self) -> GroupingMap<Self>
where + Self: Sized + Iterator<Item = (K, V)>, + K: Hash + Eq,

Constructs a GroupingMap to be used later with one of the efficient +group-and-fold operations it allows to perform. Read more
§

fn into_grouping_map_by<K, V, F>( + self, + key_mapper: F +) -> GroupingMap<MapForGrouping<Self, F>>
where + Self: Sized + Iterator<Item = V>, + K: Hash + Eq, + F: FnMut(&V) -> K,

Constructs a GroupingMap to be used later with one of the efficient +group-and-fold operations it allows to perform. Read more
§

fn min_set(self) -> Vec<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Return all minimum elements of an iterator. Read more
§

fn min_set_by<F>(self, compare: F) -> Vec<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return all minimum elements of an iterator, as determined by +the specified function. Read more
§

fn min_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return all minimum elements of an iterator, as determined by +the specified function. Read more
§

fn max_set(self) -> Vec<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Return all maximum elements of an iterator. Read more
§

fn max_set_by<F>(self, compare: F) -> Vec<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return all maximum elements of an iterator, as determined by +the specified function. Read more
§

fn max_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return all maximum elements of an iterator, as determined by +the specified function. Read more
§

fn minmax(self) -> MinMaxResult<Self::Item>
where + Self: Sized, + Self::Item: PartialOrd,

Return the minimum and maximum elements in the iterator. Read more
§

fn minmax_by_key<K, F>(self, key: F) -> MinMaxResult<Self::Item>
where + Self: Sized, + K: PartialOrd, + F: FnMut(&Self::Item) -> K,

Return the minimum and maximum element of an iterator, as determined by +the specified function. Read more
§

fn minmax_by<F>(self, compare: F) -> MinMaxResult<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the minimum and maximum element of an iterator, as determined by +the specified comparison function. Read more
§

fn position_max(self) -> Option<usize>
where + Self: Sized, + Self::Item: Ord,

Return the position of the maximum element in the iterator. Read more
§

fn position_max_by_key<K, F>(self, key: F) -> Option<usize>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return the position of the maximum element in the iterator, as +determined by the specified function. Read more
§

fn position_max_by<F>(self, compare: F) -> Option<usize>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the position of the maximum element in the iterator, as +determined by the specified comparison function. Read more
§

fn position_min(self) -> Option<usize>
where + Self: Sized, + Self::Item: Ord,

Return the position of the minimum element in the iterator. Read more
§

fn position_min_by_key<K, F>(self, key: F) -> Option<usize>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return the position of the minimum element in the iterator, as +determined by the specified function. Read more
§

fn position_min_by<F>(self, compare: F) -> Option<usize>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the position of the minimum element in the iterator, as +determined by the specified comparison function. Read more
§

fn position_minmax(self) -> MinMaxResult<usize>
where + Self: Sized, + Self::Item: PartialOrd,

Return the positions of the minimum and maximum elements in +the iterator. Read more
§

fn position_minmax_by_key<K, F>(self, key: F) -> MinMaxResult<usize>
where + Self: Sized, + K: PartialOrd, + F: FnMut(&Self::Item) -> K,

Return the postions of the minimum and maximum elements of an +iterator, as determined by the specified function. Read more
§

fn position_minmax_by<F>(self, compare: F) -> MinMaxResult<usize>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the postions of the minimum and maximum elements of an +iterator, as determined by the specified comparison function. Read more
§

fn exactly_one(self) -> Result<Self::Item, ExactlyOneError<Self>>
where + Self: Sized,

If the iterator yields exactly one element, that element will be returned, otherwise +an error will be returned containing an iterator that has the same output as the input +iterator. Read more
§

fn at_most_one(self) -> Result<Option<Self::Item>, ExactlyOneError<Self>>
where + Self: Sized,

If the iterator yields no elements, Ok(None) will be returned. If the iterator yields +exactly one element, that element will be returned, otherwise an error will be returned +containing an iterator that has the same output as the input iterator. Read more
§

fn multipeek(self) -> MultiPeek<Self>
where + Self: Sized,

An iterator adaptor that allows the user to peek at multiple .next() +values without advancing the base iterator. Read more
§

fn counts(self) -> HashMap<Self::Item, usize>
where + Self: Sized, + Self::Item: Eq + Hash,

Collect the items in this iterator and return a HashMap which +contains each item that appears in the iterator and the number +of times it appears. Read more
§

fn counts_by<K, F>(self, f: F) -> HashMap<K, usize>
where + Self: Sized, + K: Eq + Hash, + F: FnMut(Self::Item) -> K,

Collect the items in this iterator and return a HashMap which +contains each item that appears in the iterator and the number +of times it appears, +determining identity using a keying function. Read more
§

fn multiunzip<FromI>(self) -> FromI
where + Self: Sized + MultiUnzip<FromI>,

Converts an iterator of tuples into a tuple of containers. Read more
§

fn try_len(&self) -> Result<usize, (usize, Option<usize>)>

Returns the length of the iterator if one exists. +Otherwise return self.size_hint(). Read more
§

impl<T> ParallelBridge for T
where + T: Iterator + Send, + <T as Iterator>::Item: Send,

§

fn par_bridge(self) -> IterBridge<T>

Creates a bridge from this type to a ParallelIterator.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/bitboard/struct.Board.html b/docs/pabi/chess/bitboard/struct.Board.html new file mode 100644 index 00000000..9dc4a5aa --- /dev/null +++ b/docs/pabi/chess/bitboard/struct.Board.html @@ -0,0 +1,35 @@ +Board in pabi::chess::bitboard - Rust +

Struct pabi::chess::bitboard::Board

source ·
pub(super) struct Board {
+    pub(super) white_pieces: Pieces,
+    pub(super) black_pieces: Pieces,
+}
Expand description

Piece-centric implementation of the chess board. This is the “back-end” of +the chess engine, an efficient board representation is crucial for +performance. An alternative implementation would be Square-Piece table but +both have different trade-offs and scenarios where they are efficient. It is +likely that the best overall performance can be achieved by keeping both to +complement each other.

+

Fields§

§white_pieces: Pieces§black_pieces: Pieces

Implementations§

source§

impl Board

source

pub(super) fn starting() -> Self

source

pub(super) fn empty() -> Self

source

pub(super) fn player_pieces(&self, player: Player) -> &Pieces

source

pub(super) fn at(&self, square: Square) -> Option<Piece>

Trait Implementations§

source§

impl Clone for Board

source§

fn clone(&self) -> Board

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Board

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Dumps the board in a simple format (‘.’ for empty square, FEN algebraic +symbol for piece) a-la Stockfish “debug” command in UCI mode.

+
source§

impl Display for Board

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Prints board representation in FEN format.

+
source§

impl PartialEq for Board

source§

fn eq(&self, other: &Board) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Eq for Board

source§

impl StructuralPartialEq for Board

Auto Trait Implementations§

§

impl Freeze for Board

§

impl RefUnwindSafe for Board

§

impl Send for Board

§

impl Sync for Board

§

impl Unpin for Board

§

impl UnwindSafe for Board

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where + T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/bitboard/struct.Pieces.html b/docs/pabi/chess/bitboard/struct.Pieces.html new file mode 100644 index 00000000..eade8be7 --- /dev/null +++ b/docs/pabi/chess/bitboard/struct.Pieces.html @@ -0,0 +1,33 @@ +Pieces in pabi::chess::bitboard - Rust +

Struct pabi::chess::bitboard::Pieces

source ·
pub(super) struct Pieces {
+    pub(super) king: Bitboard,
+    pub(super) queens: Bitboard,
+    pub(super) rooks: Bitboard,
+    pub(super) bishops: Bitboard,
+    pub(super) knights: Bitboard,
+    pub(super) pawns: Bitboard,
+}
Expand description

Piece-centric representation of all material owned by one player. Uses +Bitboard to store a set of squares occupied by each piece. The main user +is crate::chess::position::Position, Bitboard is not very useful on +its own.

+

Fields§

§king: Bitboard§queens: Bitboard§rooks: Bitboard§bishops: Bitboard§knights: Bitboard§pawns: Bitboard

Implementations§

source§

impl Pieces

source

pub(super) fn empty() -> Self

source

pub(super) fn new_white() -> Self

source

pub(super) fn new_black() -> Self

source

pub(super) fn all(&self) -> Bitboard

source

pub(super) fn bitboard_for(&mut self, piece: PieceKind) -> &mut Bitboard

source

pub(super) fn at(&self, square: Square) -> Option<PieceKind>

source

pub(super) fn clear(&mut self, square: Square)

Trait Implementations§

source§

impl Clone for Pieces

source§

fn clone(&self) -> Pieces

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl PartialEq for Pieces

source§

fn eq(&self, other: &Pieces) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Eq for Pieces

source§

impl StructuralPartialEq for Pieces

Auto Trait Implementations§

§

impl Freeze for Pieces

§

impl RefUnwindSafe for Pieces

§

impl Send for Pieces

§

impl Sync for Pieces

§

impl Unpin for Pieces

§

impl UnwindSafe for Pieces

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/core/constant.BOARD_SIZE.html b/docs/pabi/chess/core/constant.BOARD_SIZE.html new file mode 100644 index 00000000..1ca4229e --- /dev/null +++ b/docs/pabi/chess/core/constant.BOARD_SIZE.html @@ -0,0 +1,2 @@ +BOARD_SIZE in pabi::chess::core - Rust +

Constant pabi::chess::core::BOARD_SIZE

source ·
pub const BOARD_SIZE: u8 = _; // 64u8
\ No newline at end of file diff --git a/docs/pabi/chess/core/constant.BOARD_WIDTH.html b/docs/pabi/chess/core/constant.BOARD_WIDTH.html new file mode 100644 index 00000000..ba0d123b --- /dev/null +++ b/docs/pabi/chess/core/constant.BOARD_WIDTH.html @@ -0,0 +1,2 @@ +BOARD_WIDTH in pabi::chess::core - Rust +

Constant pabi::chess::core::BOARD_WIDTH

source ·
pub const BOARD_WIDTH: u8 = 8;
\ No newline at end of file diff --git a/docs/pabi/chess/core/constant.MAX_MOVES.html b/docs/pabi/chess/core/constant.MAX_MOVES.html new file mode 100644 index 00000000..1a9f3f7a --- /dev/null +++ b/docs/pabi/chess/core/constant.MAX_MOVES.html @@ -0,0 +1,5 @@ +MAX_MOVES in pabi::chess::core - Rust +

Constant pabi::chess::core::MAX_MOVES

source ·
const MAX_MOVES: usize = 256;
Expand description

Size of MoveList and an upper bound of moves in a chess position (which +seems to be 218. 256 provides the best +performance through optimal memory alignment.

+
\ No newline at end of file diff --git a/docs/pabi/chess/core/enum.Direction.html b/docs/pabi/chess/core/enum.Direction.html new file mode 100644 index 00000000..a1335db1 --- /dev/null +++ b/docs/pabi/chess/core/enum.Direction.html @@ -0,0 +1,29 @@ +Direction in pabi::chess::core - Rust +

Enum pabi::chess::core::Direction

source ·
pub enum Direction {
+    Up,
+    Down,
+}
Expand description

Directions on the board from a perspective of White player.

+

Traditionally those are North (Up), West (Left), East (Right), South (Down) +and their combinations. However, using cardinal directions is confusing, +hence they are replaced by relative directions.

+

Variants§

§

Up

Also known as North.

+
§

Down

Also known as South.

+

Implementations§

source§

impl Direction

source

pub(super) fn opposite(self) -> Self

Trait Implementations§

source§

impl Clone for Direction

source§

fn clone(&self) -> Direction

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Direction

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl IntoEnumIterator for Direction

source§

impl Copy for Direction

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/core/enum.File.html b/docs/pabi/chess/core/enum.File.html new file mode 100644 index 00000000..5c12314d --- /dev/null +++ b/docs/pabi/chess/core/enum.File.html @@ -0,0 +1,41 @@ +File in pabi::chess::core - Rust +

Enum pabi::chess::core::File

source ·
#[repr(u8)]
pub enum File { + A = 0, + B = 1, + C = 2, + D = 3, + E = 4, + F = 5, + G = 6, + H = 7, +}
Expand description

Represents a column (vertical row) of the chessboard. In chess notation, it +is normally represented with a lowercase letter.

+

Variants§

§

A = 0

§

B = 1

§

C = 2

§

D = 3

§

E = 4

§

F = 5

§

G = 6

§

H = 7

Implementations§

source§

impl File

source

pub(super) fn mask(self) -> Bitboard

Returns a pre-calculated bitboard mask with 1s set for squares of the +given file.

+

Trait Implementations§

source§

impl Clone for File

source§

fn clone(&self) -> File

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for File

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for File

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl IntoEnumIterator for File

source§

impl Ord for File

source§

fn cmp(&self, other: &File) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for File

source§

fn eq(&self, other: &File) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for File

source§

fn partial_cmp(&self, other: &File) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
source§

impl TryFrom<char> for File

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(file: char) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<u8> for File

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(column: u8) -> Result<Self>

Performs the conversion.
source§

impl Copy for File

source§

impl Eq for File

source§

impl StructuralPartialEq for File

Auto Trait Implementations§

§

impl Freeze for File

§

impl RefUnwindSafe for File

§

impl Send for File

§

impl Sync for File

§

impl Unpin for File

§

impl UnwindSafe for File

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where + T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/core/enum.PieceKind.html b/docs/pabi/chess/core/enum.PieceKind.html new file mode 100644 index 00000000..1ac23836 --- /dev/null +++ b/docs/pabi/chess/core/enum.PieceKind.html @@ -0,0 +1,33 @@ +PieceKind in pabi::chess::core - Rust +

Enum pabi::chess::core::PieceKind

source ·
pub enum PieceKind {
+    King = 1,
+    Queen = 2,
+    Rook = 3,
+    Bishop = 4,
+    Knight = 5,
+    Pawn = 6,
+}
Expand description

Standard chess pieces.

+

Variants§

§

King = 1

§

Queen = 2

§

Rook = 3

§

Bishop = 4

§

Knight = 5

§

Pawn = 6

Trait Implementations§

source§

impl Clone for PieceKind

source§

fn clone(&self) -> PieceKind

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PieceKind

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for PieceKind

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Promotion> for PieceKind

source§

fn from(promotion: Promotion) -> Self

Converts to this type from the input type.
source§

impl PartialEq for PieceKind

source§

fn eq(&self, other: &PieceKind) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for PieceKind

source§

fn partial_cmp(&self, other: &PieceKind) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
source§

impl Copy for PieceKind

source§

impl StructuralPartialEq for PieceKind

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where + T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/core/enum.Player.html b/docs/pabi/chess/core/enum.Player.html new file mode 100644 index 00000000..09c545b4 --- /dev/null +++ b/docs/pabi/chess/core/enum.Player.html @@ -0,0 +1,29 @@ +Player in pabi::chess::core - Rust +

Enum pabi::chess::core::Player

source ·
pub enum Player {
+    White,
+    Black,
+}
Expand description

A standard game of chess is played between two players: White (having the +advantage of the first turn) and Black.

+

Variants§

§

White

§

Black

Implementations§

source§

impl Player

source

pub fn opponent(self) -> Self

“Flips” the color.

+
source

pub(super) fn push_direction(self) -> Direction

Trait Implementations§

source§

impl Clone for Player

source§

fn clone(&self) -> Player

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Player

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Player

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for Player

source§

fn eq(&self, other: &Player) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<&str> for Player

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(player: &str) -> Result<Self>

Performs the conversion.
source§

impl Copy for Player

source§

impl Eq for Player

source§

impl StructuralPartialEq for Player

Auto Trait Implementations§

§

impl Freeze for Player

§

impl RefUnwindSafe for Player

§

impl Send for Player

§

impl Sync for Player

§

impl Unpin for Player

§

impl UnwindSafe for Player

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where + T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/core/enum.Promotion.html b/docs/pabi/chess/core/enum.Promotion.html new file mode 100644 index 00000000..6c856dee --- /dev/null +++ b/docs/pabi/chess/core/enum.Promotion.html @@ -0,0 +1,30 @@ +Promotion in pabi::chess::core - Rust +

Enum pabi::chess::core::Promotion

source ·
pub enum Promotion {
+    Queen,
+    Rook,
+    Bishop,
+    Knight,
+}
Expand description

A pawn can be promoted to a queen, rook, bishop or a knight.

+

Variants§

§

Queen

§

Rook

§

Bishop

§

Knight

Trait Implementations§

source§

impl Clone for Promotion

source§

fn clone(&self) -> Promotion

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Promotion

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Promotion> for PieceKind

source§

fn from(promotion: Promotion) -> Self

Converts to this type from the input type.
source§

impl PartialEq for Promotion

source§

fn eq(&self, other: &Promotion) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Promotion

source§

fn partial_cmp(&self, other: &Promotion) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
source§

impl Copy for Promotion

source§

impl StructuralPartialEq for Promotion

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/core/enum.Rank.html b/docs/pabi/chess/core/enum.Rank.html new file mode 100644 index 00000000..a11b05f7 --- /dev/null +++ b/docs/pabi/chess/core/enum.Rank.html @@ -0,0 +1,42 @@ +Rank in pabi::chess::core - Rust +

Enum pabi::chess::core::Rank

source ·
#[repr(u8)]
pub enum Rank { + One = 0, + Two = 1, + Three = 2, + Four = 3, + Five = 4, + Six = 5, + Seven = 6, + Eight = 7, +}
Expand description

Represents a horizontal row of the chessboard. In chess notation, it is +represented with a number. The implementation assumes zero-based values +(i.e. rank 1 would be 0).

+

Variants§

§

One = 0

§

Two = 1

§

Three = 2

§

Four = 3

§

Five = 4

§

Six = 5

§

Seven = 6

§

Eight = 7

Implementations§

source§

impl Rank

source

pub(super) fn mask(self) -> Bitboard

Returns a pre-calculated bitboard mask with 1s set for squares of the +given rank.

+
source

pub(super) fn backrank(player: Player) -> Self

source

pub(super) fn pawns_starting(player: Player) -> Self

Trait Implementations§

source§

impl Clone for Rank

source§

fn clone(&self) -> Rank

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Rank

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Rank

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl IntoEnumIterator for Rank

source§

impl Ord for Rank

source§

fn cmp(&self, other: &Rank) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for Rank

source§

fn eq(&self, other: &Rank) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Rank

source§

fn partial_cmp(&self, other: &Rank) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
source§

impl TryFrom<char> for Rank

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(rank: char) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<u8> for Rank

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(row: u8) -> Result<Self>

Performs the conversion.
source§

impl Copy for Rank

source§

impl Eq for Rank

source§

impl StructuralPartialEq for Rank

Auto Trait Implementations§

§

impl Freeze for Rank

§

impl RefUnwindSafe for Rank

§

impl Send for Rank

§

impl Sync for Rank

§

impl Unpin for Rank

§

impl UnwindSafe for Rank

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where + T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/core/enum.Square.html b/docs/pabi/chess/core/enum.Square.html new file mode 100644 index 00000000..70bb9c68 --- /dev/null +++ b/docs/pabi/chess/core/enum.Square.html @@ -0,0 +1,114 @@ +Square in pabi::chess::core - Rust +

Enum pabi::chess::core::Square

source ·
#[repr(u8)]
pub enum Square { +
Show 64 variants A1 = 0, + B1 = 1, + C1 = 2, + D1 = 3, + E1 = 4, + F1 = 5, + G1 = 6, + H1 = 7, + A2 = 8, + B2 = 9, + C2 = 10, + D2 = 11, + E2 = 12, + F2 = 13, + G2 = 14, + H2 = 15, + A3 = 16, + B3 = 17, + C3 = 18, + D3 = 19, + E3 = 20, + F3 = 21, + G3 = 22, + H3 = 23, + A4 = 24, + B4 = 25, + C4 = 26, + D4 = 27, + E4 = 28, + F4 = 29, + G4 = 30, + H4 = 31, + A5 = 32, + B5 = 33, + C5 = 34, + D5 = 35, + E5 = 36, + F5 = 37, + G5 = 38, + H5 = 39, + A6 = 40, + B6 = 41, + C6 = 42, + D6 = 43, + E6 = 44, + F6 = 45, + G6 = 46, + H6 = 47, + A7 = 48, + B7 = 49, + C7 = 50, + D7 = 51, + E7 = 52, + F7 = 53, + G7 = 54, + H7 = 55, + A8 = 56, + B8 = 57, + C8 = 58, + D8 = 59, + E8 = 60, + F8 = 61, + G8 = 62, + H8 = 63, +
}
Expand description

Board squares: from left to right, from bottom to the top (Little-Endian Rank-File Mapping):

+ +
use pabi::chess::core::Square;
+
+assert_eq!(Square::A1 as u8, 0);
+assert_eq!(Square::E1 as u8, 4);
+assert_eq!(Square::H1 as u8, 7);
+assert_eq!(Square::A4 as u8, 8 * 3);
+assert_eq!(Square::H8 as u8, 63);
+

Square is a compact representation using only one byte.

+ +
use pabi::chess::core::Square;
+use std::mem;
+
+assert_eq!(std::mem::size_of::<Square>(), 1);
+

Variants§

§

A1 = 0

§

B1 = 1

§

C1 = 2

§

D1 = 3

§

E1 = 4

§

F1 = 5

§

G1 = 6

§

H1 = 7

§

A2 = 8

§

B2 = 9

§

C2 = 10

§

D2 = 11

§

E2 = 12

§

F2 = 13

§

G2 = 14

§

H2 = 15

§

A3 = 16

§

B3 = 17

§

C3 = 18

§

D3 = 19

§

E3 = 20

§

F3 = 21

§

G3 = 22

§

H3 = 23

§

A4 = 24

§

B4 = 25

§

C4 = 26

§

D4 = 27

§

E4 = 28

§

F4 = 29

§

G4 = 30

§

H4 = 31

§

A5 = 32

§

B5 = 33

§

C5 = 34

§

D5 = 35

§

E5 = 36

§

F5 = 37

§

G5 = 38

§

H5 = 39

§

A6 = 40

§

B6 = 41

§

C6 = 42

§

D6 = 43

§

E6 = 44

§

F6 = 45

§

G6 = 46

§

H6 = 47

§

A7 = 48

§

B7 = 49

§

C7 = 50

§

D7 = 51

§

E7 = 52

§

F7 = 53

§

G7 = 54

§

H7 = 55

§

A8 = 56

§

B8 = 57

§

C8 = 58

§

D8 = 59

§

E8 = 60

§

F8 = 61

§

G8 = 62

§

H8 = 63

Implementations§

source§

impl Square

source

pub const fn new(file: File, rank: Rank) -> Self

Connects file (column) and rank (row) to form a full square.

+
source

pub const fn file(self) -> File

Returns file (column) on which the square is located.

+
source

pub const fn rank(self) -> Rank

Returns rank (row) on which the square is located.

+
source

pub fn shift(self, direction: Direction) -> Option<Self>

Trait Implementations§

source§

impl Clone for Square

source§

fn clone(&self) -> Square

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Square

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Square

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Square> for Bitboard

source§

fn from(square: Square) -> Self

Converts to this type from the input type.
source§

impl IntoEnumIterator for Square

source§

impl Ord for Square

source§

fn cmp(&self, other: &Square) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where + Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for Square

source§

fn eq(&self, other: &Square) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Square

source§

fn partial_cmp(&self, other: &Square) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
source§

impl TryFrom<&str> for Square

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(square: &str) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<u8> for Square

source§

fn try_from(square_index: u8) -> Result<Self>

Creates a square given its position on the board.

+
§Errors
+

If given square index is outside 0..BOARD_SIZE range.

+
§

type Error = Error

The type returned in the event of a conversion error.
source§

impl TryInto<Square> for Bitboard

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<Square>

Performs the conversion.
source§

impl Copy for Square

source§

impl Eq for Square

source§

impl StructuralPartialEq for Square

Auto Trait Implementations§

§

impl Freeze for Square

§

impl RefUnwindSafe for Square

§

impl Send for Square

§

impl Sync for Square

§

impl Unpin for Square

§

impl UnwindSafe for Square

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where + T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/core/index.html b/docs/pabi/chess/core/index.html new file mode 100644 index 00000000..e33565ab --- /dev/null +++ b/docs/pabi/chess/core/index.html @@ -0,0 +1,20 @@ +pabi::chess::core - Rust +

Module pabi::chess::core

source ·
Expand description

Chess primitives commonly used within crate::chess.

+

Structs§

  • Track the ability to castle each side (kingside is often referred to +as O-O or h-side castle, queenside – O-O-O or a-side castle). When the +king moves, player loses ability to castle. When the rook moves, player +loses ability to castle to the side from which the rook moved.
  • An iterator over the variants of Direction
  • An iterator over the variants of File
  • Represents any kind of a legal chess move. A move is the only way to mutate +crate::chess::position::Position and change the board state. Moves are +not sorted according to their potential “value” by the move generator. The +move representation has one-to-one correspondence with the UCI move +representation. The moves can also be indexed and fed as an input to the +Neural Network evaluators that would be able assess their potential without +evaluating post-states.
  • Represents a specific piece owned by a player.
  • An iterator over the variants of Rank
  • An iterator over the variants of Square

Enums§

  • Directions on the board from a perspective of White player.
  • Represents a column (vertical row) of the chessboard. In chess notation, it +is normally represented with a lowercase letter.
  • Standard chess pieces.
  • A standard game of chess is played between two players: White (having the +advantage of the first turn) and Black.
  • A pawn can be promoted to a queen, rook, bishop or a knight.
  • Represents a horizontal row of the chessboard. In chess notation, it is +represented with a number. The implementation assumes zero-based values +(i.e. rank 1 would be 0).
  • Board squares: from left to right, from bottom to the top (Little-Endian Rank-File Mapping):

Constants§

Type Aliases§

  • Moves are stored on stack to avoid memory allocations. This is important for +performance reasons and also prevents unnecessary copying that would occur +if the moves would be stored in std::Vec with unknown capacity.
\ No newline at end of file diff --git a/docs/pabi/chess/core/sidebar-items.js b/docs/pabi/chess/core/sidebar-items.js new file mode 100644 index 00000000..4d9d94b3 --- /dev/null +++ b/docs/pabi/chess/core/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["BOARD_SIZE","BOARD_WIDTH","MAX_MOVES"],"enum":["Direction","File","PieceKind","Player","Promotion","Rank","Square"],"struct":["CastleRights","DirectionIter","FileIter","Move","Piece","RankIter","SquareIter"],"type":["MoveList"]}; \ No newline at end of file diff --git a/docs/pabi/chess/core/struct.CastleRights.html b/docs/pabi/chess/core/struct.CastleRights.html new file mode 100644 index 00000000..95052bd6 --- /dev/null +++ b/docs/pabi/chess/core/struct.CastleRights.html @@ -0,0 +1,111 @@ +CastleRights in pabi::chess::core - Rust +

Struct pabi::chess::core::CastleRights

source ·
pub struct CastleRights(<CastleRights as PublicFlags>::Internal);
Expand description

Track the ability to castle each side (kingside is often referred to +as O-O or h-side castle, queenside – O-O-O or a-side castle). When the +king moves, player loses ability to castle. When the rook moves, player +loses ability to castle to the side from which the rook moved.

+

Castling is relatively straightforward in the Standard Chess but is +often misunderstood in Fischer Random Chess (also known as FRC or +Chess960). An easy mnemonic is that the king and the rook end up on the +same files for both Standard and FRC:

+
    +
  • When castling h-side (short), the king ends up on File::G and the +rook on File::F
  • +
  • When castling a-side (long), the king ends up on File::C and the +rook on File::D
  • +
+

The full rules are:

+
    +
  • The king and the castling rook must not have previously moved.
  • +
  • No square from the king’s initial square to its final square may be under +attack by an enemy piece.
  • +
  • All the squares between the king’s initial and final squares +(including the final square), and all the squares between the castling +rook’s initial and final squares (including the final square), must be +vacant except for the king and castling rook.
  • +
+

Tuple Fields§

§0: <CastleRights as PublicFlags>::Internal

Implementations§

source§

impl CastleRights

source

pub const NONE: Self = _

source

pub const WHITE_SHORT: Self = _

source

pub const WHITE_LONG: Self = _

source

pub const WHITE_BOTH: Self = _

source

pub const BLACK_SHORT: Self = _

source

pub const BLACK_LONG: Self = _

source

pub const BLACK_BOTH: Self = _

source

pub const ALL: Self = _

source§

impl CastleRights

source

pub const fn empty() -> Self

Get a flags value with all bits unset.

+
source

pub const fn all() -> Self

Get a flags value with all known bits set.

+
source

pub const fn bits(&self) -> u8

Get the underlying bits value.

+

The returned value is exactly the bits set in this flags value.

+
source

pub const fn from_bits(bits: u8) -> Option<Self>

Convert from a bits value.

+

This method will return None if any unknown bits are set.

+
source

pub const fn from_bits_truncate(bits: u8) -> Self

Convert from a bits value, unsetting any unknown bits.

+
source

pub const fn from_bits_retain(bits: u8) -> Self

Convert from a bits value exactly.

+
source

pub fn from_name(name: &str) -> Option<Self>

Get a flags value with the bits of a flag with the given name set.

+

This method will return None if name is empty or doesn’t +correspond to any named flag.

+
source

pub const fn is_empty(&self) -> bool

Whether all bits in this flags value are unset.

+
source

pub const fn is_all(&self) -> bool

Whether all known bits in this flags value are set.

+
source

pub const fn intersects(&self, other: Self) -> bool

Whether any set bits in a source flags value are also set in a target flags value.

+
source

pub const fn contains(&self, other: Self) -> bool

Whether all set bits in a source flags value are also set in a target flags value.

+
source

pub fn insert(&mut self, other: Self)

The bitwise or (|) of the bits in two flags values.

+
source

pub fn remove(&mut self, other: Self)

The intersection of a source flags value with the complement of a target flags value (&!).

+

This method is not equivalent to self & !other when other has unknown bits set. +remove won’t truncate other, but the ! operator will.

+
source

pub fn toggle(&mut self, other: Self)

The bitwise exclusive-or (^) of the bits in two flags values.

+
source

pub fn set(&mut self, other: Self, value: bool)

Call insert when value is true or remove when value is false.

+
source

pub const fn intersection(self, other: Self) -> Self

The bitwise and (&) of the bits in two flags values.

+
source

pub const fn union(self, other: Self) -> Self

The bitwise or (|) of the bits in two flags values.

+
source

pub const fn difference(self, other: Self) -> Self

The intersection of a source flags value with the complement of a target flags value (&!).

+

This method is not equivalent to self & !other when other has unknown bits set. +difference won’t truncate other, but the ! operator will.

+
source

pub const fn symmetric_difference(self, other: Self) -> Self

The bitwise exclusive-or (^) of the bits in two flags values.

+
source

pub const fn complement(self) -> Self

The bitwise negation (!) of the bits in a flags value, truncating the result.

+
source§

impl CastleRights

source

pub const fn iter(&self) -> Iter<CastleRights>

Yield a set of contained flags values.

+

Each yielded flags value will correspond to a defined named flag. Any unknown bits +will be yielded together as a final flags value.

+
source

pub const fn iter_names(&self) -> IterNames<CastleRights>

Yield a set of contained named flags values.

+

This method is like iter, except only yields bits in contained named flags. +Any unknown bits, or bits not corresponding to a contained flag will not be yielded.

+
source§

impl CastleRights

source

fn mask(player: Player) -> Self

Trait Implementations§

source§

impl Binary for CastleRights

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl BitAnd for CastleRights

source§

fn bitand(self, other: Self) -> Self

The bitwise and (&) of the bits in two flags values.

+
§

type Output = CastleRights

The resulting type after applying the & operator.
source§

impl BitAndAssign for CastleRights

source§

fn bitand_assign(&mut self, other: Self)

The bitwise and (&) of the bits in two flags values.

+
source§

impl BitOr for CastleRights

source§

fn bitor(self, other: CastleRights) -> Self

The bitwise or (|) of the bits in two flags values.

+
§

type Output = CastleRights

The resulting type after applying the | operator.
source§

impl BitOrAssign for CastleRights

source§

fn bitor_assign(&mut self, other: Self)

The bitwise or (|) of the bits in two flags values.

+
source§

impl BitXor for CastleRights

source§

fn bitxor(self, other: Self) -> Self

The bitwise exclusive-or (^) of the bits in two flags values.

+
§

type Output = CastleRights

The resulting type after applying the ^ operator.
source§

impl BitXorAssign for CastleRights

source§

fn bitxor_assign(&mut self, other: Self)

The bitwise exclusive-or (^) of the bits in two flags values.

+
source§

impl Clone for CastleRights

source§

fn clone(&self) -> CastleRights

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CastleRights

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for CastleRights

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Extend<CastleRights> for CastleRights

source§

fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)

The bitwise or (|) of the bits in each flags value.

+
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl Flags for CastleRights

source§

const FLAGS: &'static [Flag<CastleRights>] = _

The set of defined flags.
§

type Bits = u8

The underlying bits type.
source§

fn bits(&self) -> u8

Get the underlying bits value. Read more
source§

fn from_bits_retain(bits: u8) -> CastleRights

Convert from a bits value exactly.
§

fn empty() -> Self

Get a flags value with all bits unset.
§

fn all() -> Self

Get a flags value with all known bits set.
§

fn from_bits(bits: Self::Bits) -> Option<Self>

Convert from a bits value. Read more
§

fn from_bits_truncate(bits: Self::Bits) -> Self

Convert from a bits value, unsetting any unknown bits.
§

fn from_name(name: &str) -> Option<Self>

Get a flags value with the bits of a flag with the given name set. Read more
§

fn iter(&self) -> Iter<Self>

Yield a set of contained flags values. Read more
§

fn iter_names(&self) -> IterNames<Self>

Yield a set of contained named flags values. Read more
§

fn is_empty(&self) -> bool

Whether all bits in this flags value are unset.
§

fn is_all(&self) -> bool

Whether all known bits in this flags value are set.
§

fn intersects(&self, other: Self) -> bool
where + Self: Sized,

Whether any set bits in a source flags value are also set in a target flags value.
§

fn contains(&self, other: Self) -> bool
where + Self: Sized,

Whether all set bits in a source flags value are also set in a target flags value.
§

fn insert(&mut self, other: Self)
where + Self: Sized,

The bitwise or (|) of the bits in two flags values.
§

fn remove(&mut self, other: Self)
where + Self: Sized,

The intersection of a source flags value with the complement of a target flags value (&!). Read more
§

fn toggle(&mut self, other: Self)
where + Self: Sized,

The bitwise exclusive-or (^) of the bits in two flags values.
§

fn set(&mut self, other: Self, value: bool)
where + Self: Sized,

Call [Flags::insert] when value is true or [Flags::remove] when value is false.
§

fn intersection(self, other: Self) -> Self

The bitwise and (&) of the bits in two flags values.
§

fn union(self, other: Self) -> Self

The bitwise or (|) of the bits in two flags values.
§

fn difference(self, other: Self) -> Self

The intersection of a source flags value with the complement of a target flags value (&!). Read more
§

fn symmetric_difference(self, other: Self) -> Self

The bitwise exclusive-or (^) of the bits in two flags values.
§

fn complement(self) -> Self

The bitwise negation (!) of the bits in a flags value, truncating the result.
source§

impl FromIterator<CastleRights> for CastleRights

source§

fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self

The bitwise or (|) of the bits in each flags value.

+
source§

impl Hash for CastleRights

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl IntoIterator for CastleRights

§

type Item = CastleRights

The type of the elements being iterated over.
§

type IntoIter = Iter<CastleRights>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl LowerHex for CastleRights

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl Not for CastleRights

source§

fn not(self) -> Self

The bitwise negation (!) of the bits in a flags value, truncating the result.

+
§

type Output = CastleRights

The resulting type after applying the ! operator.
source§

impl Octal for CastleRights

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl PartialEq for CastleRights

source§

fn eq(&self, other: &CastleRights) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl PublicFlags for CastleRights

§

type Primitive = u8

The type of the underlying storage.
§

type Internal = InternalBitFlags

The type of the internal field on the generated flags type.
source§

impl Sub for CastleRights

source§

fn sub(self, other: Self) -> Self

The intersection of a source flags value with the complement of a target flags value (&!).

+

This method is not equivalent to self & !other when other has unknown bits set. +difference won’t truncate other, but the ! operator will.

+
§

type Output = CastleRights

The resulting type after applying the - operator.
source§

impl SubAssign for CastleRights

source§

fn sub_assign(&mut self, other: Self)

The intersection of a source flags value with the complement of a target flags value (&!).

+

This method is not equivalent to self & !other when other has unknown bits set. +difference won’t truncate other, but the ! operator will.

+
source§

impl TryFrom<&str> for CastleRights

source§

fn try_from(input: &str) -> Result<Self>

Parses CastleRights for both players from the FEN format. The user +is responsible for providing valid input cleaned up from the actual FEN +chunk.

+
§Errors
+

Returns anyhow::Error if given pattern does not match

+

CastleRights := (K)? (Q)? (k)? (q)?

+

Note that both letters have to be either uppercase or lowercase.

+
§

type Error = Error

The type returned in the event of a conversion error.
source§

impl UpperHex for CastleRights

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl Copy for CastleRights

source§

impl Eq for CastleRights

source§

impl StructuralPartialEq for CastleRights

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where + T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/core/struct.DirectionIter.html b/docs/pabi/chess/core/struct.DirectionIter.html new file mode 100644 index 00000000..a25c9627 --- /dev/null +++ b/docs/pabi/chess/core/struct.DirectionIter.html @@ -0,0 +1,626 @@ +DirectionIter in pabi::chess::core - Rust +

Struct pabi::chess::core::DirectionIter

source ·
pub struct DirectionIter {
+    idx: usize,
+    back_idx: usize,
+    marker: PhantomData<()>,
+}
Expand description

An iterator over the variants of Direction

+

Fields§

§idx: usize§back_idx: usize§marker: PhantomData<()>

Implementations§

Trait Implementations§

source§

impl Clone for DirectionIter

source§

fn clone(&self) -> DirectionIter

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DirectionIter

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl DoubleEndedIterator for DirectionIter

source§

fn next_back(&mut self) -> Option<<Self as Iterator>::Item>

Removes and returns an element from the end of the iterator. Read more
source§

fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator from the back by n elements. Read more
1.37.0 · source§

fn nth_back(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element from the end of the iterator. Read more
1.27.0 · source§

fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

This is the reverse version of Iterator::try_fold(): it takes +elements starting from the back of the iterator. Read more
1.27.0 · source§

fn rfold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

An iterator method that reduces the iterator’s elements to a single, +final value, starting from the back. Read more
1.27.0 · source§

fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator from the back that satisfies a predicate. Read more
source§

impl ExactSizeIterator for DirectionIter

source§

fn len(&self) -> usize

Returns the exact remaining length of the iterator. Read more
source§

fn is_empty(&self) -> bool

🔬This is a nightly-only experimental API. (exact_size_is_empty)
Returns true if the iterator is empty. Read more
source§

impl Iterator for DirectionIter

§

type Item = Direction

The type of the elements being iterated over.
source§

fn next(&mut self) -> Option<<Self as Iterator>::Item>

Advances the iterator and returns the next value. Read more
source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
source§

fn nth(&mut self, n: usize) -> Option<<Self as Iterator>::Item>

Returns the nth element of the iterator. Read more
source§

fn next_chunk<const N: usize>( + &mut self +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · source§

fn count(self) -> usize
where + Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 · source§

fn last(self) -> Option<Self::Item>
where + Self: Sized,

Consumes the iterator, returning the last element. Read more
source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.28.0 · source§

fn step_by(self, step: usize) -> StepBy<Self>
where + Self: Sized,

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
1.0.0 · source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where + Self: Sized, + Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more
source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where + Self: Sized, + G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
1.0.0 · source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each +element. Read more
1.21.0 · source§

fn for_each<F>(self, f: F)
where + Self: Sized, + F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
1.0.0 · source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · source§

fn enumerate(self) -> Enumerate<Self>
where + Self: Sized,

Creates an iterator which gives the current iteration count as well as +the next value. Read more
1.0.0 · source§

fn peekable(self) -> Peekable<Self>
where + Self: Sized,

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more
1.0.0 · source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · source§

fn skip(self, n: usize) -> Skip<Self>
where + Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · source§

fn take(self, n: usize) -> Take<Self>
where + Self: Sized,

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
1.0.0 · source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
1.0.0 · source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where + Self: Sized, + F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over +self and returns an iterator over the outputs of f. Like slice::windows(), +the windows during mapping overlap as well. Read more
1.0.0 · source§

fn fuse(self) -> Fuse<Self>
where + Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · source§

fn by_ref(&mut self) -> &mut Self
where + Self: Sized,

Borrows an iterator, rather than consuming it. Read more
1.0.0 · source§

fn collect<B>(self) -> B
where + B: FromIterator<Self::Item>, + Self: Sized,

Transforms an iterator into a collection. Read more
source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where + E: Extend<Self::Item>, + Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · source§

fn partition<B, F>(self, f: F) -> (B, B)
where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
source§

fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
where + T: 'a, + Self: Sized + DoubleEndedIterator<Item = &'a mut T>, + P: FnMut(&T) -> bool,

🔬This is a nightly-only experimental API. (iter_partition_in_place)
Reorders the elements of this iterator in-place according to the given predicate, +such that all those that return true precede all those that return false. +Returns the number of true elements found. Read more
source§

fn is_partitioned<P>(self, predicate: P) -> bool
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
1.27.0 · source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
1.27.0 · source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
1.0.0 · source§

fn fold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, +returning the final result. Read more
1.51.0 · source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
source§

fn try_reduce<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> R, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · source§

fn all<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · source§

fn any<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns +the first non-none result. Read more
source§

fn try_find<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where + Self: Sized, + F: FnMut(&Self::Item) -> R, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
1.0.0 · source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.0.0 · source§

fn rposition<P>(&mut self, predicate: P) -> Option<usize>
where + P: FnMut(Self::Item) -> bool, + Self: Sized + ExactSizeIterator + DoubleEndedIterator,

Searches for an element in an iterator from the right, returning its +index. Read more
1.6.0 · source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the +specified function. Read more
1.15.0 · source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
1.6.0 · source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the +specified function. Read more
1.15.0 · source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
1.0.0 · source§

fn rev(self) -> Rev<Self>
where + Self: Sized + DoubleEndedIterator,

Reverses an iterator’s direction. Read more
1.0.0 · source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · source§

fn copied<'a, T>(self) -> Copied<Self>
where + T: 'a + Copy, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · source§

fn cloned<'a, T>(self) -> Cloned<Self>
where + T: 'a + Clone, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
1.0.0 · source§

fn cycle(self) -> Cycle<Self>
where + Self: Sized + Clone,

Repeats an iterator endlessly. Read more
source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · source§

fn sum<S>(self) -> S
where + Self: Sized, + S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · source§

fn product<P>(self) -> P
where + Self: Sized, + P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · source§

fn eq<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are equal to those of +another. Read more
source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
1.5.0 · source§

fn ne<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are not equal to those of +another. Read more
1.5.0 · source§

fn lt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
1.5.0 · source§

fn le<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
1.5.0 · source§

fn gt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
1.5.0 · source§

fn ge<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
source§

fn is_sorted_by<F>(self, compare: F) -> bool
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> bool,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given comparator function. Read more
source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given key extraction +function. Read more
source§

impl FusedIterator for DirectionIter

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

impl<I> IntoIterator for I
where + I: Iterator,

§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
§

type IntoIter = I

Which kind of iterator are we turning this into?
const: unstable · source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
§

impl<T> Itertools for T
where + T: Iterator + ?Sized,

§

fn interleave<J>( + self, + other: J +) -> Interleave<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator<Item = Self::Item>, + Self: Sized,

Alternate elements from two iterators until both have run out. Read more
§

fn interleave_shortest<J>( + self, + other: J +) -> InterleaveShortest<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator<Item = Self::Item>, + Self: Sized,

Alternate elements from two iterators until at least one of them has run +out. Read more
§

fn intersperse( + self, + element: Self::Item +) -> IntersperseWith<Self, IntersperseElementSimple<Self::Item>>
where + Self: Sized, + Self::Item: Clone,

An iterator adaptor to insert a particular value +between each element of the adapted iterator. Read more
§

fn intersperse_with<F>(self, element: F) -> IntersperseWith<Self, F>
where + Self: Sized, + F: FnMut() -> Self::Item,

An iterator adaptor to insert a particular value created by a function +between each element of the adapted iterator. Read more
§

fn zip_longest<J>( + self, + other: J +) -> ZipLongest<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator, + Self: Sized,

Create an iterator which iterates over both this and the specified +iterator simultaneously, yielding pairs of two optional elements. Read more
§

fn zip_eq<J>(self, other: J) -> ZipEq<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator, + Self: Sized,

Create an iterator which iterates over both this and the specified +iterator simultaneously, yielding pairs of elements. Read more
§

fn batching<B, F>(self, f: F) -> Batching<Self, F>
where + F: FnMut(&mut Self) -> Option<B>, + Self: Sized,

A “meta iterator adaptor”. Its closure receives a reference to the +iterator and may pick off as many elements as it likes, to produce the +next iterator element. Read more
§

fn group_by<K, F>(self, key: F) -> GroupBy<K, Self, F>
where + Self: Sized, + F: FnMut(&Self::Item) -> K, + K: PartialEq,

Return an iterable that can group iterator elements. +Consecutive elements that map to the same key (“runs”), are assigned +to the same group. Read more
§

fn chunks(self, size: usize) -> IntoChunks<Self>
where + Self: Sized,

Return an iterable that can chunk the iterator. Read more
§

fn tuple_windows<T>(self) -> TupleWindows<Self, T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple, + <T as TupleCollect>::Item: Clone,

Return an iterator over all contiguous windows producing tuples of +a specific size (up to 12). Read more
§

fn circular_tuple_windows<T>(self) -> CircularTupleWindows<Self, T>
where + Self: Sized + Clone + Iterator<Item = <T as TupleCollect>::Item> + ExactSizeIterator, + T: TupleCollect + Clone, + <T as TupleCollect>::Item: Clone,

Return an iterator over all windows, wrapping back to the first +elements when the window would otherwise exceed the length of the +iterator, producing tuples of a specific size (up to 12). Read more
§

fn tuples<T>(self) -> Tuples<Self, T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple,

Return an iterator that groups the items in tuples of a specific size +(up to 12). Read more
§

fn tee(self) -> (Tee<Self>, Tee<Self>)
where + Self: Sized, + Self::Item: Clone,

Split into an iterator pair that both yield all elements from +the original iterator. Read more
§

fn step(self, n: usize) -> Step<Self>
where + Self: Sized,

👎Deprecated since 0.8.0: Use std .step_by() instead
Return an iterator adaptor that steps n elements in the base iterator +for each iteration. Read more
§

fn map_into<R>(self) -> MapSpecialCase<Self, MapSpecialCaseFnInto<R>>
where + Self: Sized, + Self::Item: Into<R>,

Convert each item of the iterator using the Into trait. Read more
§

fn map_results<F, T, U, E>( + self, + f: F +) -> MapSpecialCase<Self, MapSpecialCaseFnOk<F>>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(T) -> U,

👎Deprecated since 0.10.0: Use .map_ok() instead
§

fn map_ok<F, T, U, E>(self, f: F) -> MapSpecialCase<Self, MapSpecialCaseFnOk<F>>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(T) -> U,

Return an iterator adaptor that applies the provided closure +to every Result::Ok value. Result::Err values are +unchanged. Read more
§

fn filter_ok<F, T, E>(self, f: F) -> FilterOk<Self, F>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(&T) -> bool,

Return an iterator adaptor that filters every Result::Ok +value with the provided closure. Result::Err values are +unchanged. Read more
§

fn filter_map_ok<F, T, U, E>(self, f: F) -> FilterMapOk<Self, F>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(T) -> Option<U>,

Return an iterator adaptor that filters and transforms every +Result::Ok value with the provided closure. Result::Err +values are unchanged. Read more
§

fn flatten_ok<T, E>(self) -> FlattenOk<Self, T, E>
where + Self: Sized + Iterator<Item = Result<T, E>>, + T: IntoIterator,

Return an iterator adaptor that flattens every Result::Ok value into +a series of Result::Ok values. Result::Err values are unchanged. Read more
§

fn process_results<F, T, E, R>(self, processor: F) -> Result<R, E>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnOnce(ProcessResults<'_, Self, E>) -> R,

“Lift” a function of the values of the current iterator so as to process +an iterator of Result values instead. Read more
§

fn merge<J>( + self, + other: J +) -> MergeBy<Self, <J as IntoIterator>::IntoIter, MergeLte>
where + Self: Sized, + Self::Item: PartialOrd, + J: IntoIterator<Item = Self::Item>,

Return an iterator adaptor that merges the two base iterators in +ascending order. If both base iterators are sorted (ascending), the +result is sorted. Read more
§

fn merge_by<J, F>( + self, + other: J, + is_first: F +) -> MergeBy<Self, <J as IntoIterator>::IntoIter, F>
where + Self: Sized, + J: IntoIterator<Item = Self::Item>, + F: FnMut(&Self::Item, &Self::Item) -> bool,

Return an iterator adaptor that merges the two base iterators in order. +This is much like .merge() but allows for a custom ordering. Read more
§

fn merge_join_by<J, F, T>( + self, + other: J, + cmp_fn: F +) -> MergeBy<Self, <J as IntoIterator>::IntoIter, MergeFuncLR<F, <F as FuncLR<Self::Item, <<J as IntoIterator>::IntoIter as Iterator>::Item>>::T>>
where + J: IntoIterator, + F: FnMut(&Self::Item, &<J as IntoIterator>::Item) -> T, + Self: Sized,

Create an iterator that merges items from both this and the specified +iterator in ascending order. Read more
§

fn kmerge(self) -> KMergeBy<<Self::Item as IntoIterator>::IntoIter, KMergeByLt>
where + Self: Sized, + Self::Item: IntoIterator, + <Self::Item as IntoIterator>::Item: PartialOrd,

Return an iterator adaptor that flattens an iterator of iterators by +merging them in ascending order. Read more
§

fn kmerge_by<F>( + self, + first: F +) -> KMergeBy<<Self::Item as IntoIterator>::IntoIter, F>
where + Self: Sized, + Self::Item: IntoIterator, + F: FnMut(&<Self::Item as IntoIterator>::Item, &<Self::Item as IntoIterator>::Item) -> bool,

Return an iterator adaptor that flattens an iterator of iterators by +merging them according to the given closure. Read more
§

fn cartesian_product<J>( + self, + other: J +) -> Product<Self, <J as IntoIterator>::IntoIter>
where + Self: Sized, + Self::Item: Clone, + J: IntoIterator, + <J as IntoIterator>::IntoIter: Clone,

Return an iterator adaptor that iterates over the cartesian product of +the element sets of two iterators self and J. Read more
§

fn multi_cartesian_product( + self +) -> MultiProduct<<Self::Item as IntoIterator>::IntoIter>
where + Self: Sized, + Self::Item: IntoIterator, + <Self::Item as IntoIterator>::IntoIter: Clone, + <Self::Item as IntoIterator>::Item: Clone,

Return an iterator adaptor that iterates over the cartesian product of +all subiterators returned by meta-iterator self. Read more
§

fn coalesce<F>(self, f: F) -> CoalesceBy<Self, F, NoCount>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Result<Self::Item, (Self::Item, Self::Item)>,

Return an iterator adaptor that uses the passed-in closure to +optionally merge together consecutive elements. Read more
§

fn dedup(self) -> CoalesceBy<Self, DedupPred2CoalescePred<DedupEq>, NoCount>
where + Self: Sized, + Self::Item: PartialEq,

Remove duplicates from sections of consecutive identical elements. +If the iterator is sorted, all elements will be unique. Read more
§

fn dedup_by<Cmp>( + self, + cmp: Cmp +) -> CoalesceBy<Self, DedupPred2CoalescePred<Cmp>, NoCount>
where + Self: Sized, + Cmp: FnMut(&Self::Item, &Self::Item) -> bool,

Remove duplicates from sections of consecutive identical elements, +determining equality using a comparison function. +If the iterator is sorted, all elements will be unique. Read more
§

fn dedup_with_count( + self +) -> CoalesceBy<Self, DedupPredWithCount2CoalescePred<DedupEq>, WithCount>
where + Self: Sized,

Remove duplicates from sections of consecutive identical elements, while keeping a count of +how many repeated elements were present. +If the iterator is sorted, all elements will be unique. Read more
§

fn dedup_by_with_count<Cmp>( + self, + cmp: Cmp +) -> CoalesceBy<Self, DedupPredWithCount2CoalescePred<Cmp>, WithCount>
where + Self: Sized, + Cmp: FnMut(&Self::Item, &Self::Item) -> bool,

Remove duplicates from sections of consecutive identical elements, while keeping a count of +how many repeated elements were present. +This will determine equality using a comparison function. +If the iterator is sorted, all elements will be unique. Read more
§

fn duplicates(self) -> DuplicatesBy<Self, Self::Item, ById>
where + Self: Sized, + Self::Item: Eq + Hash,

Return an iterator adaptor that produces elements that appear more than once during the +iteration. Duplicates are detected using hash and equality. Read more
§

fn duplicates_by<V, F>(self, f: F) -> DuplicatesBy<Self, V, ByFn<F>>
where + Self: Sized, + V: Eq + Hash, + F: FnMut(&Self::Item) -> V,

Return an iterator adaptor that produces elements that appear more than once during the +iteration. Duplicates are detected using hash and equality. Read more
§

fn unique(self) -> Unique<Self>
where + Self: Sized, + Self::Item: Clone + Eq + Hash,

Return an iterator adaptor that filters out elements that have +already been produced once during the iteration. Duplicates +are detected using hash and equality. Read more
§

fn unique_by<V, F>(self, f: F) -> UniqueBy<Self, V, F>
where + Self: Sized, + V: Eq + Hash, + F: FnMut(&Self::Item) -> V,

Return an iterator adaptor that filters out elements that have +already been produced once during the iteration. Read more
§

fn peeking_take_while<F>(&mut self, accept: F) -> PeekingTakeWhile<'_, Self, F>
where + Self: Sized + PeekingNext, + F: FnMut(&Self::Item) -> bool,

Return an iterator adaptor that borrows from this iterator and +takes items while the closure accept returns true. Read more
§

fn take_while_ref<F>(&mut self, accept: F) -> TakeWhileRef<'_, Self, F>
where + Self: Clone, + F: FnMut(&Self::Item) -> bool,

Return an iterator adaptor that borrows from a Clone-able iterator +to only pick off elements while the predicate accept returns true. Read more
§

fn take_while_inclusive<F>(self, accept: F) -> TakeWhileInclusive<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item) -> bool,

Returns an iterator adaptor that consumes elements while the given +predicate is true, including the element for which the predicate +first returned false. Read more
§

fn while_some<A>(self) -> WhileSome<Self>
where + Self: Sized + Iterator<Item = Option<A>>,

Return an iterator adaptor that filters Option<A> iterator elements +and produces A. Stops on the first None encountered. Read more
§

fn tuple_combinations<T>(self) -> TupleCombinations<Self, T>
where + Self: Sized + Clone, + Self::Item: Clone, + T: HasCombination<Self>,

Return an iterator adaptor that iterates over the combinations of the +elements from an iterator. Read more
§

fn combinations(self, k: usize) -> Combinations<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator adaptor that iterates over the k-length combinations of +the elements from an iterator. Read more
§

fn combinations_with_replacement( + self, + k: usize +) -> CombinationsWithReplacement<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator that iterates over the k-length combinations of +the elements from an iterator, with replacement. Read more
§

fn permutations(self, k: usize) -> Permutations<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator adaptor that iterates over all k-permutations of the +elements from an iterator. Read more
§

fn powerset(self) -> Powerset<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator that iterates through the powerset of the elements from an +iterator. Read more
§

fn pad_using<F>(self, min: usize, f: F) -> PadUsing<Self, F>
where + Self: Sized, + F: FnMut(usize) -> Self::Item,

Return an iterator adaptor that pads the sequence to a minimum length of +min by filling missing elements using a closure f. Read more
§

fn with_position(self) -> WithPosition<Self>
where + Self: Sized,

Return an iterator adaptor that combines each element with a Position to +ease special-case handling of the first or last elements. Read more
§

fn positions<P>(self, predicate: P) -> Positions<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Return an iterator adaptor that yields the indices of all elements +satisfying a predicate, counted from the start of the iterator. Read more
§

fn update<F>(self, updater: F) -> Update<Self, F>
where + Self: Sized, + F: FnMut(&mut Self::Item),

Return an iterator adaptor that applies a mutating function +to each element before yielding it. Read more
§

fn next_tuple<T>(&mut self) -> Option<T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple,

Advances the iterator and returns the next items grouped in a tuple of +a specific size (up to 12). Read more
§

fn collect_tuple<T>(self) -> Option<T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple,

Collects all items from the iterator into a tuple of a specific size +(up to 12). Read more
§

fn find_position<P>(&mut self, pred: P) -> Option<(usize, Self::Item)>
where + P: FnMut(&Self::Item) -> bool,

Find the position and value of the first element satisfying a predicate. Read more
§

fn find_or_last<P>(self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Find the value of the first element satisfying a predicate or return the last element, if any. Read more
§

fn find_or_first<P>(self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Find the value of the first element satisfying a predicate or return the first element, if any. Read more
§

fn contains<Q>(&mut self, query: &Q) -> bool
where + Self: Sized, + Self::Item: Borrow<Q>, + Q: PartialEq,

Returns true if the given item is present in this iterator. Read more
§

fn all_equal(&mut self) -> bool
where + Self: Sized, + Self::Item: PartialEq,

Check whether all elements compare equal. Read more
§

fn all_equal_value( + &mut self +) -> Result<Self::Item, Option<(Self::Item, Self::Item)>>
where + Self: Sized, + Self::Item: PartialEq,

If there are elements and they are all equal, return a single copy of that element. +If there are no elements, return an Error containing None. +If there are elements and they are not all equal, return a tuple containing the first +two non-equal elements found. Read more
§

fn all_unique(&mut self) -> bool
where + Self: Sized, + Self::Item: Eq + Hash,

Check whether all elements are unique (non equal). Read more
§

fn dropping(self, n: usize) -> Self
where + Self: Sized,

Consume the first n elements from the iterator eagerly, +and return the same iterator again. Read more
§

fn dropping_back(self, n: usize) -> Self
where + Self: Sized + DoubleEndedIterator,

Consume the last n elements from the iterator eagerly, +and return the same iterator again. Read more
§

fn foreach<F>(self, f: F)
where + F: FnMut(Self::Item), + Self: Sized,

👎Deprecated since 0.8.0: Use .for_each() instead
Run the closure f eagerly on each element of the iterator. Read more
§

fn concat(self) -> Self::Item
where + Self: Sized, + Self::Item: Extend<<Self::Item as IntoIterator>::Item> + IntoIterator + Default,

Combine all an iterator’s elements into one element by using Extend. Read more
§

fn collect_vec(self) -> Vec<Self::Item>
where + Self: Sized,

.collect_vec() is simply a type specialization of Iterator::collect, +for convenience.
§

fn try_collect<T, U, E>(self) -> Result<U, E>
where + Self: Sized + Iterator<Item = Result<T, E>>, + Result<U, E>: FromIterator<Result<T, E>>,

.try_collect() is more convenient way of writing +.collect::<Result<_, _>>() Read more
§

fn set_from<'a, A, J>(&mut self, from: J) -> usize
where + A: 'a, + Self: Iterator<Item = &'a mut A>, + J: IntoIterator<Item = A>,

Assign to each reference in self from the from iterator, +stopping at the shortest of the two iterators. Read more
§

fn join(&mut self, sep: &str) -> String
where + Self::Item: Display,

Combine all iterator elements into one String, separated by sep. Read more
§

fn format(self, sep: &str) -> Format<'_, Self>
where + Self: Sized,

Format all iterator elements, separated by sep. Read more
§

fn format_with<F>(self, sep: &str, format: F) -> FormatWith<'_, Self, F>
where + Self: Sized, + F: FnMut(Self::Item, &mut dyn FnMut(&dyn Display) -> Result<(), Error>) -> Result<(), Error>,

Format all iterator elements, separated by sep. Read more
§

fn fold_results<A, E, B, F>(&mut self, start: B, f: F) -> Result<B, E>
where + Self: Iterator<Item = Result<A, E>>, + F: FnMut(B, A) -> B,

👎Deprecated since 0.10.0: Use .fold_ok() instead
§

fn fold_ok<A, E, B, F>(&mut self, start: B, f: F) -> Result<B, E>
where + Self: Iterator<Item = Result<A, E>>, + F: FnMut(B, A) -> B,

Fold Result values from an iterator. Read more
§

fn fold_options<A, B, F>(&mut self, start: B, f: F) -> Option<B>
where + Self: Iterator<Item = Option<A>>, + F: FnMut(B, A) -> B,

Fold Option values from an iterator. Read more
§

fn fold1<F>(self, f: F) -> Option<Self::Item>
where + F: FnMut(Self::Item, Self::Item) -> Self::Item, + Self: Sized,

👎Deprecated since 0.10.2: Use Iterator::reduce instead
Accumulator of the elements in the iterator. Read more
§

fn tree_fold1<F>(self, f: F) -> Option<Self::Item>
where + F: FnMut(Self::Item, Self::Item) -> Self::Item, + Self: Sized,

Accumulate the elements in the iterator in a tree-like manner. Read more
§

fn fold_while<B, F>(&mut self, init: B, f: F) -> FoldWhile<B>
where + Self: Sized, + F: FnMut(B, Self::Item) -> FoldWhile<B>,

An iterator method that applies a function, producing a single, final value. Read more
§

fn sum1<S>(self) -> Option<S>
where + Self: Sized, + S: Sum<Self::Item>,

Iterate over the entire iterator and add all the elements. Read more
§

fn product1<P>(self) -> Option<P>
where + Self: Sized, + P: Product<Self::Item>,

Iterate over the entire iterator and multiply all the elements. Read more
§

fn sorted_unstable(self) -> IntoIter<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_unstable_by<F>(self, cmp: F) -> IntoIter<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_unstable_by_key<K, F>(self, f: F) -> IntoIter<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted(self) -> IntoIter<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_by<F>(self, cmp: F) -> IntoIter<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_by_key<K, F>(self, f: F) -> IntoIter<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_by_cached_key<K, F>(self, f: F) -> IntoIter<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Sort all iterator elements into a new iterator in ascending order. The key function is +called exactly once per key. Read more
§

fn k_smallest(self, k: usize) -> IntoIter<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Sort the k smallest elements into a new iterator, in ascending order. Read more
§

fn partition_map<A, B, F, L, R>(self, predicate: F) -> (A, B)
where + Self: Sized, + F: FnMut(Self::Item) -> Either<L, R>, + A: Default + Extend<L>, + B: Default + Extend<R>,

Collect all iterator elements into one of two +partitions. Unlike Iterator::partition, each partition may +have a distinct type. Read more
§

fn partition_result<A, B, T, E>(self) -> (A, B)
where + Self: Sized + Iterator<Item = Result<T, E>>, + A: Default + Extend<T>, + B: Default + Extend<E>,

Partition a sequence of Results into one list of all the Ok elements +and another list of all the Err elements. Read more
§

fn into_group_map<K, V>(self) -> HashMap<K, Vec<V>>
where + Self: Sized + Iterator<Item = (K, V)>, + K: Hash + Eq,

Return a HashMap of keys mapped to Vecs of values. Keys and values +are taken from (Key, Value) tuple pairs yielded by the input iterator. Read more
§

fn into_group_map_by<K, V, F>(self, f: F) -> HashMap<K, Vec<V>>
where + Self: Sized + Iterator<Item = V>, + K: Hash + Eq, + F: Fn(&V) -> K,

Return an Iterator on a HashMap. Keys mapped to Vecs of values. The key is specified +in the closure. Read more
§

fn into_grouping_map<K, V>(self) -> GroupingMap<Self>
where + Self: Sized + Iterator<Item = (K, V)>, + K: Hash + Eq,

Constructs a GroupingMap to be used later with one of the efficient +group-and-fold operations it allows to perform. Read more
§

fn into_grouping_map_by<K, V, F>( + self, + key_mapper: F +) -> GroupingMap<MapForGrouping<Self, F>>
where + Self: Sized + Iterator<Item = V>, + K: Hash + Eq, + F: FnMut(&V) -> K,

Constructs a GroupingMap to be used later with one of the efficient +group-and-fold operations it allows to perform. Read more
§

fn min_set(self) -> Vec<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Return all minimum elements of an iterator. Read more
§

fn min_set_by<F>(self, compare: F) -> Vec<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return all minimum elements of an iterator, as determined by +the specified function. Read more
§

fn min_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return all minimum elements of an iterator, as determined by +the specified function. Read more
§

fn max_set(self) -> Vec<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Return all maximum elements of an iterator. Read more
§

fn max_set_by<F>(self, compare: F) -> Vec<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return all maximum elements of an iterator, as determined by +the specified function. Read more
§

fn max_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return all maximum elements of an iterator, as determined by +the specified function. Read more
§

fn minmax(self) -> MinMaxResult<Self::Item>
where + Self: Sized, + Self::Item: PartialOrd,

Return the minimum and maximum elements in the iterator. Read more
§

fn minmax_by_key<K, F>(self, key: F) -> MinMaxResult<Self::Item>
where + Self: Sized, + K: PartialOrd, + F: FnMut(&Self::Item) -> K,

Return the minimum and maximum element of an iterator, as determined by +the specified function. Read more
§

fn minmax_by<F>(self, compare: F) -> MinMaxResult<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the minimum and maximum element of an iterator, as determined by +the specified comparison function. Read more
§

fn position_max(self) -> Option<usize>
where + Self: Sized, + Self::Item: Ord,

Return the position of the maximum element in the iterator. Read more
§

fn position_max_by_key<K, F>(self, key: F) -> Option<usize>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return the position of the maximum element in the iterator, as +determined by the specified function. Read more
§

fn position_max_by<F>(self, compare: F) -> Option<usize>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the position of the maximum element in the iterator, as +determined by the specified comparison function. Read more
§

fn position_min(self) -> Option<usize>
where + Self: Sized, + Self::Item: Ord,

Return the position of the minimum element in the iterator. Read more
§

fn position_min_by_key<K, F>(self, key: F) -> Option<usize>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return the position of the minimum element in the iterator, as +determined by the specified function. Read more
§

fn position_min_by<F>(self, compare: F) -> Option<usize>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the position of the minimum element in the iterator, as +determined by the specified comparison function. Read more
§

fn position_minmax(self) -> MinMaxResult<usize>
where + Self: Sized, + Self::Item: PartialOrd,

Return the positions of the minimum and maximum elements in +the iterator. Read more
§

fn position_minmax_by_key<K, F>(self, key: F) -> MinMaxResult<usize>
where + Self: Sized, + K: PartialOrd, + F: FnMut(&Self::Item) -> K,

Return the postions of the minimum and maximum elements of an +iterator, as determined by the specified function. Read more
§

fn position_minmax_by<F>(self, compare: F) -> MinMaxResult<usize>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the postions of the minimum and maximum elements of an +iterator, as determined by the specified comparison function. Read more
§

fn exactly_one(self) -> Result<Self::Item, ExactlyOneError<Self>>
where + Self: Sized,

If the iterator yields exactly one element, that element will be returned, otherwise +an error will be returned containing an iterator that has the same output as the input +iterator. Read more
§

fn at_most_one(self) -> Result<Option<Self::Item>, ExactlyOneError<Self>>
where + Self: Sized,

If the iterator yields no elements, Ok(None) will be returned. If the iterator yields +exactly one element, that element will be returned, otherwise an error will be returned +containing an iterator that has the same output as the input iterator. Read more
§

fn multipeek(self) -> MultiPeek<Self>
where + Self: Sized,

An iterator adaptor that allows the user to peek at multiple .next() +values without advancing the base iterator. Read more
§

fn counts(self) -> HashMap<Self::Item, usize>
where + Self: Sized, + Self::Item: Eq + Hash,

Collect the items in this iterator and return a HashMap which +contains each item that appears in the iterator and the number +of times it appears. Read more
§

fn counts_by<K, F>(self, f: F) -> HashMap<K, usize>
where + Self: Sized, + K: Eq + Hash, + F: FnMut(Self::Item) -> K,

Collect the items in this iterator and return a HashMap which +contains each item that appears in the iterator and the number +of times it appears, +determining identity using a keying function. Read more
§

fn multiunzip<FromI>(self) -> FromI
where + Self: Sized + MultiUnzip<FromI>,

Converts an iterator of tuples into a tuple of containers. Read more
§

fn try_len(&self) -> Result<usize, (usize, Option<usize>)>

Returns the length of the iterator if one exists. +Otherwise return self.size_hint(). Read more
§

impl<T> ParallelBridge for T
where + T: Iterator + Send, + <T as Iterator>::Item: Send,

§

fn par_bridge(self) -> IterBridge<T>

Creates a bridge from this type to a ParallelIterator.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/core/struct.FileIter.html b/docs/pabi/chess/core/struct.FileIter.html new file mode 100644 index 00000000..f02abde7 --- /dev/null +++ b/docs/pabi/chess/core/struct.FileIter.html @@ -0,0 +1,636 @@ +FileIter in pabi::chess::core - Rust +

Struct pabi::chess::core::FileIter

source ·
pub struct FileIter {
+    idx: usize,
+    back_idx: usize,
+    marker: PhantomData<()>,
+}
Expand description

An iterator over the variants of File

+

Fields§

§idx: usize§back_idx: usize§marker: PhantomData<()>

Implementations§

source§

impl FileIter

source

fn get(&self, idx: usize) -> Option<File>

Trait Implementations§

source§

impl Clone for FileIter

source§

fn clone(&self) -> FileIter

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for FileIter

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl DoubleEndedIterator for FileIter

source§

fn next_back(&mut self) -> Option<<Self as Iterator>::Item>

Removes and returns an element from the end of the iterator. Read more
source§

fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator from the back by n elements. Read more
1.37.0 · source§

fn nth_back(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element from the end of the iterator. Read more
1.27.0 · source§

fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

This is the reverse version of Iterator::try_fold(): it takes +elements starting from the back of the iterator. Read more
1.27.0 · source§

fn rfold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

An iterator method that reduces the iterator’s elements to a single, +final value, starting from the back. Read more
1.27.0 · source§

fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator from the back that satisfies a predicate. Read more
source§

impl ExactSizeIterator for FileIter

source§

fn len(&self) -> usize

Returns the exact remaining length of the iterator. Read more
source§

fn is_empty(&self) -> bool

🔬This is a nightly-only experimental API. (exact_size_is_empty)
Returns true if the iterator is empty. Read more
source§

impl Iterator for FileIter

§

type Item = File

The type of the elements being iterated over.
source§

fn next(&mut self) -> Option<<Self as Iterator>::Item>

Advances the iterator and returns the next value. Read more
source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
source§

fn nth(&mut self, n: usize) -> Option<<Self as Iterator>::Item>

Returns the nth element of the iterator. Read more
source§

fn next_chunk<const N: usize>( + &mut self +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · source§

fn count(self) -> usize
where + Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 · source§

fn last(self) -> Option<Self::Item>
where + Self: Sized,

Consumes the iterator, returning the last element. Read more
source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.28.0 · source§

fn step_by(self, step: usize) -> StepBy<Self>
where + Self: Sized,

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
1.0.0 · source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where + Self: Sized, + Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more
source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where + Self: Sized, + G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
1.0.0 · source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each +element. Read more
1.21.0 · source§

fn for_each<F>(self, f: F)
where + Self: Sized, + F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
1.0.0 · source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · source§

fn enumerate(self) -> Enumerate<Self>
where + Self: Sized,

Creates an iterator which gives the current iteration count as well as +the next value. Read more
1.0.0 · source§

fn peekable(self) -> Peekable<Self>
where + Self: Sized,

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more
1.0.0 · source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · source§

fn skip(self, n: usize) -> Skip<Self>
where + Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · source§

fn take(self, n: usize) -> Take<Self>
where + Self: Sized,

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
1.0.0 · source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
1.0.0 · source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where + Self: Sized, + F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over +self and returns an iterator over the outputs of f. Like slice::windows(), +the windows during mapping overlap as well. Read more
1.0.0 · source§

fn fuse(self) -> Fuse<Self>
where + Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · source§

fn by_ref(&mut self) -> &mut Self
where + Self: Sized,

Borrows an iterator, rather than consuming it. Read more
1.0.0 · source§

fn collect<B>(self) -> B
where + B: FromIterator<Self::Item>, + Self: Sized,

Transforms an iterator into a collection. Read more
source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where + E: Extend<Self::Item>, + Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · source§

fn partition<B, F>(self, f: F) -> (B, B)
where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
source§

fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
where + T: 'a, + Self: Sized + DoubleEndedIterator<Item = &'a mut T>, + P: FnMut(&T) -> bool,

🔬This is a nightly-only experimental API. (iter_partition_in_place)
Reorders the elements of this iterator in-place according to the given predicate, +such that all those that return true precede all those that return false. +Returns the number of true elements found. Read more
source§

fn is_partitioned<P>(self, predicate: P) -> bool
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
1.27.0 · source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
1.27.0 · source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
1.0.0 · source§

fn fold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, +returning the final result. Read more
1.51.0 · source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
source§

fn try_reduce<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> R, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · source§

fn all<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · source§

fn any<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns +the first non-none result. Read more
source§

fn try_find<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where + Self: Sized, + F: FnMut(&Self::Item) -> R, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
1.0.0 · source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.0.0 · source§

fn rposition<P>(&mut self, predicate: P) -> Option<usize>
where + P: FnMut(Self::Item) -> bool, + Self: Sized + ExactSizeIterator + DoubleEndedIterator,

Searches for an element in an iterator from the right, returning its +index. Read more
1.0.0 · source§

fn max(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the maximum element of an iterator. Read more
1.0.0 · source§

fn min(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the minimum element of an iterator. Read more
1.6.0 · source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the +specified function. Read more
1.15.0 · source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
1.6.0 · source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the +specified function. Read more
1.15.0 · source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
1.0.0 · source§

fn rev(self) -> Rev<Self>
where + Self: Sized + DoubleEndedIterator,

Reverses an iterator’s direction. Read more
1.0.0 · source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · source§

fn copied<'a, T>(self) -> Copied<Self>
where + T: 'a + Copy, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · source§

fn cloned<'a, T>(self) -> Cloned<Self>
where + T: 'a + Clone, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
1.0.0 · source§

fn cycle(self) -> Cycle<Self>
where + Self: Sized + Clone,

Repeats an iterator endlessly. Read more
source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · source§

fn sum<S>(self) -> S
where + Self: Sized, + S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · source§

fn product<P>(self) -> P
where + Self: Sized, + P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
1.5.0 · source§

fn cmp<I>(self, other: I) -> Ordering
where + I: IntoIterator<Item = Self::Item>, + Self::Item: Ord, + Self: Sized,

Lexicographically compares the elements of this Iterator with those +of another. Read more
source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · source§

fn eq<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are equal to those of +another. Read more
source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
1.5.0 · source§

fn ne<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are not equal to those of +another. Read more
1.5.0 · source§

fn lt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
1.5.0 · source§

fn le<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
1.5.0 · source§

fn gt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
1.5.0 · source§

fn ge<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
source§

fn is_sorted(self) -> bool
where + Self: Sized, + Self::Item: PartialOrd,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted. Read more
source§

fn is_sorted_by<F>(self, compare: F) -> bool
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> bool,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given comparator function. Read more
source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given key extraction +function. Read more
source§

impl FusedIterator for FileIter

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

impl<I> IntoIterator for I
where + I: Iterator,

§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
§

type IntoIter = I

Which kind of iterator are we turning this into?
const: unstable · source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
§

impl<T> Itertools for T
where + T: Iterator + ?Sized,

§

fn interleave<J>( + self, + other: J +) -> Interleave<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator<Item = Self::Item>, + Self: Sized,

Alternate elements from two iterators until both have run out. Read more
§

fn interleave_shortest<J>( + self, + other: J +) -> InterleaveShortest<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator<Item = Self::Item>, + Self: Sized,

Alternate elements from two iterators until at least one of them has run +out. Read more
§

fn intersperse( + self, + element: Self::Item +) -> IntersperseWith<Self, IntersperseElementSimple<Self::Item>>
where + Self: Sized, + Self::Item: Clone,

An iterator adaptor to insert a particular value +between each element of the adapted iterator. Read more
§

fn intersperse_with<F>(self, element: F) -> IntersperseWith<Self, F>
where + Self: Sized, + F: FnMut() -> Self::Item,

An iterator adaptor to insert a particular value created by a function +between each element of the adapted iterator. Read more
§

fn zip_longest<J>( + self, + other: J +) -> ZipLongest<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator, + Self: Sized,

Create an iterator which iterates over both this and the specified +iterator simultaneously, yielding pairs of two optional elements. Read more
§

fn zip_eq<J>(self, other: J) -> ZipEq<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator, + Self: Sized,

Create an iterator which iterates over both this and the specified +iterator simultaneously, yielding pairs of elements. Read more
§

fn batching<B, F>(self, f: F) -> Batching<Self, F>
where + F: FnMut(&mut Self) -> Option<B>, + Self: Sized,

A “meta iterator adaptor”. Its closure receives a reference to the +iterator and may pick off as many elements as it likes, to produce the +next iterator element. Read more
§

fn group_by<K, F>(self, key: F) -> GroupBy<K, Self, F>
where + Self: Sized, + F: FnMut(&Self::Item) -> K, + K: PartialEq,

Return an iterable that can group iterator elements. +Consecutive elements that map to the same key (“runs”), are assigned +to the same group. Read more
§

fn chunks(self, size: usize) -> IntoChunks<Self>
where + Self: Sized,

Return an iterable that can chunk the iterator. Read more
§

fn tuple_windows<T>(self) -> TupleWindows<Self, T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple, + <T as TupleCollect>::Item: Clone,

Return an iterator over all contiguous windows producing tuples of +a specific size (up to 12). Read more
§

fn circular_tuple_windows<T>(self) -> CircularTupleWindows<Self, T>
where + Self: Sized + Clone + Iterator<Item = <T as TupleCollect>::Item> + ExactSizeIterator, + T: TupleCollect + Clone, + <T as TupleCollect>::Item: Clone,

Return an iterator over all windows, wrapping back to the first +elements when the window would otherwise exceed the length of the +iterator, producing tuples of a specific size (up to 12). Read more
§

fn tuples<T>(self) -> Tuples<Self, T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple,

Return an iterator that groups the items in tuples of a specific size +(up to 12). Read more
§

fn tee(self) -> (Tee<Self>, Tee<Self>)
where + Self: Sized, + Self::Item: Clone,

Split into an iterator pair that both yield all elements from +the original iterator. Read more
§

fn step(self, n: usize) -> Step<Self>
where + Self: Sized,

👎Deprecated since 0.8.0: Use std .step_by() instead
Return an iterator adaptor that steps n elements in the base iterator +for each iteration. Read more
§

fn map_into<R>(self) -> MapSpecialCase<Self, MapSpecialCaseFnInto<R>>
where + Self: Sized, + Self::Item: Into<R>,

Convert each item of the iterator using the Into trait. Read more
§

fn map_results<F, T, U, E>( + self, + f: F +) -> MapSpecialCase<Self, MapSpecialCaseFnOk<F>>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(T) -> U,

👎Deprecated since 0.10.0: Use .map_ok() instead
§

fn map_ok<F, T, U, E>(self, f: F) -> MapSpecialCase<Self, MapSpecialCaseFnOk<F>>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(T) -> U,

Return an iterator adaptor that applies the provided closure +to every Result::Ok value. Result::Err values are +unchanged. Read more
§

fn filter_ok<F, T, E>(self, f: F) -> FilterOk<Self, F>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(&T) -> bool,

Return an iterator adaptor that filters every Result::Ok +value with the provided closure. Result::Err values are +unchanged. Read more
§

fn filter_map_ok<F, T, U, E>(self, f: F) -> FilterMapOk<Self, F>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(T) -> Option<U>,

Return an iterator adaptor that filters and transforms every +Result::Ok value with the provided closure. Result::Err +values are unchanged. Read more
§

fn flatten_ok<T, E>(self) -> FlattenOk<Self, T, E>
where + Self: Sized + Iterator<Item = Result<T, E>>, + T: IntoIterator,

Return an iterator adaptor that flattens every Result::Ok value into +a series of Result::Ok values. Result::Err values are unchanged. Read more
§

fn process_results<F, T, E, R>(self, processor: F) -> Result<R, E>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnOnce(ProcessResults<'_, Self, E>) -> R,

“Lift” a function of the values of the current iterator so as to process +an iterator of Result values instead. Read more
§

fn merge<J>( + self, + other: J +) -> MergeBy<Self, <J as IntoIterator>::IntoIter, MergeLte>
where + Self: Sized, + Self::Item: PartialOrd, + J: IntoIterator<Item = Self::Item>,

Return an iterator adaptor that merges the two base iterators in +ascending order. If both base iterators are sorted (ascending), the +result is sorted. Read more
§

fn merge_by<J, F>( + self, + other: J, + is_first: F +) -> MergeBy<Self, <J as IntoIterator>::IntoIter, F>
where + Self: Sized, + J: IntoIterator<Item = Self::Item>, + F: FnMut(&Self::Item, &Self::Item) -> bool,

Return an iterator adaptor that merges the two base iterators in order. +This is much like .merge() but allows for a custom ordering. Read more
§

fn merge_join_by<J, F, T>( + self, + other: J, + cmp_fn: F +) -> MergeBy<Self, <J as IntoIterator>::IntoIter, MergeFuncLR<F, <F as FuncLR<Self::Item, <<J as IntoIterator>::IntoIter as Iterator>::Item>>::T>>
where + J: IntoIterator, + F: FnMut(&Self::Item, &<J as IntoIterator>::Item) -> T, + Self: Sized,

Create an iterator that merges items from both this and the specified +iterator in ascending order. Read more
§

fn kmerge(self) -> KMergeBy<<Self::Item as IntoIterator>::IntoIter, KMergeByLt>
where + Self: Sized, + Self::Item: IntoIterator, + <Self::Item as IntoIterator>::Item: PartialOrd,

Return an iterator adaptor that flattens an iterator of iterators by +merging them in ascending order. Read more
§

fn kmerge_by<F>( + self, + first: F +) -> KMergeBy<<Self::Item as IntoIterator>::IntoIter, F>
where + Self: Sized, + Self::Item: IntoIterator, + F: FnMut(&<Self::Item as IntoIterator>::Item, &<Self::Item as IntoIterator>::Item) -> bool,

Return an iterator adaptor that flattens an iterator of iterators by +merging them according to the given closure. Read more
§

fn cartesian_product<J>( + self, + other: J +) -> Product<Self, <J as IntoIterator>::IntoIter>
where + Self: Sized, + Self::Item: Clone, + J: IntoIterator, + <J as IntoIterator>::IntoIter: Clone,

Return an iterator adaptor that iterates over the cartesian product of +the element sets of two iterators self and J. Read more
§

fn multi_cartesian_product( + self +) -> MultiProduct<<Self::Item as IntoIterator>::IntoIter>
where + Self: Sized, + Self::Item: IntoIterator, + <Self::Item as IntoIterator>::IntoIter: Clone, + <Self::Item as IntoIterator>::Item: Clone,

Return an iterator adaptor that iterates over the cartesian product of +all subiterators returned by meta-iterator self. Read more
§

fn coalesce<F>(self, f: F) -> CoalesceBy<Self, F, NoCount>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Result<Self::Item, (Self::Item, Self::Item)>,

Return an iterator adaptor that uses the passed-in closure to +optionally merge together consecutive elements. Read more
§

fn dedup(self) -> CoalesceBy<Self, DedupPred2CoalescePred<DedupEq>, NoCount>
where + Self: Sized, + Self::Item: PartialEq,

Remove duplicates from sections of consecutive identical elements. +If the iterator is sorted, all elements will be unique. Read more
§

fn dedup_by<Cmp>( + self, + cmp: Cmp +) -> CoalesceBy<Self, DedupPred2CoalescePred<Cmp>, NoCount>
where + Self: Sized, + Cmp: FnMut(&Self::Item, &Self::Item) -> bool,

Remove duplicates from sections of consecutive identical elements, +determining equality using a comparison function. +If the iterator is sorted, all elements will be unique. Read more
§

fn dedup_with_count( + self +) -> CoalesceBy<Self, DedupPredWithCount2CoalescePred<DedupEq>, WithCount>
where + Self: Sized,

Remove duplicates from sections of consecutive identical elements, while keeping a count of +how many repeated elements were present. +If the iterator is sorted, all elements will be unique. Read more
§

fn dedup_by_with_count<Cmp>( + self, + cmp: Cmp +) -> CoalesceBy<Self, DedupPredWithCount2CoalescePred<Cmp>, WithCount>
where + Self: Sized, + Cmp: FnMut(&Self::Item, &Self::Item) -> bool,

Remove duplicates from sections of consecutive identical elements, while keeping a count of +how many repeated elements were present. +This will determine equality using a comparison function. +If the iterator is sorted, all elements will be unique. Read more
§

fn duplicates(self) -> DuplicatesBy<Self, Self::Item, ById>
where + Self: Sized, + Self::Item: Eq + Hash,

Return an iterator adaptor that produces elements that appear more than once during the +iteration. Duplicates are detected using hash and equality. Read more
§

fn duplicates_by<V, F>(self, f: F) -> DuplicatesBy<Self, V, ByFn<F>>
where + Self: Sized, + V: Eq + Hash, + F: FnMut(&Self::Item) -> V,

Return an iterator adaptor that produces elements that appear more than once during the +iteration. Duplicates are detected using hash and equality. Read more
§

fn unique(self) -> Unique<Self>
where + Self: Sized, + Self::Item: Clone + Eq + Hash,

Return an iterator adaptor that filters out elements that have +already been produced once during the iteration. Duplicates +are detected using hash and equality. Read more
§

fn unique_by<V, F>(self, f: F) -> UniqueBy<Self, V, F>
where + Self: Sized, + V: Eq + Hash, + F: FnMut(&Self::Item) -> V,

Return an iterator adaptor that filters out elements that have +already been produced once during the iteration. Read more
§

fn peeking_take_while<F>(&mut self, accept: F) -> PeekingTakeWhile<'_, Self, F>
where + Self: Sized + PeekingNext, + F: FnMut(&Self::Item) -> bool,

Return an iterator adaptor that borrows from this iterator and +takes items while the closure accept returns true. Read more
§

fn take_while_ref<F>(&mut self, accept: F) -> TakeWhileRef<'_, Self, F>
where + Self: Clone, + F: FnMut(&Self::Item) -> bool,

Return an iterator adaptor that borrows from a Clone-able iterator +to only pick off elements while the predicate accept returns true. Read more
§

fn take_while_inclusive<F>(self, accept: F) -> TakeWhileInclusive<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item) -> bool,

Returns an iterator adaptor that consumes elements while the given +predicate is true, including the element for which the predicate +first returned false. Read more
§

fn while_some<A>(self) -> WhileSome<Self>
where + Self: Sized + Iterator<Item = Option<A>>,

Return an iterator adaptor that filters Option<A> iterator elements +and produces A. Stops on the first None encountered. Read more
§

fn tuple_combinations<T>(self) -> TupleCombinations<Self, T>
where + Self: Sized + Clone, + Self::Item: Clone, + T: HasCombination<Self>,

Return an iterator adaptor that iterates over the combinations of the +elements from an iterator. Read more
§

fn combinations(self, k: usize) -> Combinations<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator adaptor that iterates over the k-length combinations of +the elements from an iterator. Read more
§

fn combinations_with_replacement( + self, + k: usize +) -> CombinationsWithReplacement<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator that iterates over the k-length combinations of +the elements from an iterator, with replacement. Read more
§

fn permutations(self, k: usize) -> Permutations<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator adaptor that iterates over all k-permutations of the +elements from an iterator. Read more
§

fn powerset(self) -> Powerset<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator that iterates through the powerset of the elements from an +iterator. Read more
§

fn pad_using<F>(self, min: usize, f: F) -> PadUsing<Self, F>
where + Self: Sized, + F: FnMut(usize) -> Self::Item,

Return an iterator adaptor that pads the sequence to a minimum length of +min by filling missing elements using a closure f. Read more
§

fn with_position(self) -> WithPosition<Self>
where + Self: Sized,

Return an iterator adaptor that combines each element with a Position to +ease special-case handling of the first or last elements. Read more
§

fn positions<P>(self, predicate: P) -> Positions<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Return an iterator adaptor that yields the indices of all elements +satisfying a predicate, counted from the start of the iterator. Read more
§

fn update<F>(self, updater: F) -> Update<Self, F>
where + Self: Sized, + F: FnMut(&mut Self::Item),

Return an iterator adaptor that applies a mutating function +to each element before yielding it. Read more
§

fn next_tuple<T>(&mut self) -> Option<T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple,

Advances the iterator and returns the next items grouped in a tuple of +a specific size (up to 12). Read more
§

fn collect_tuple<T>(self) -> Option<T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple,

Collects all items from the iterator into a tuple of a specific size +(up to 12). Read more
§

fn find_position<P>(&mut self, pred: P) -> Option<(usize, Self::Item)>
where + P: FnMut(&Self::Item) -> bool,

Find the position and value of the first element satisfying a predicate. Read more
§

fn find_or_last<P>(self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Find the value of the first element satisfying a predicate or return the last element, if any. Read more
§

fn find_or_first<P>(self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Find the value of the first element satisfying a predicate or return the first element, if any. Read more
§

fn contains<Q>(&mut self, query: &Q) -> bool
where + Self: Sized, + Self::Item: Borrow<Q>, + Q: PartialEq,

Returns true if the given item is present in this iterator. Read more
§

fn all_equal(&mut self) -> bool
where + Self: Sized, + Self::Item: PartialEq,

Check whether all elements compare equal. Read more
§

fn all_equal_value( + &mut self +) -> Result<Self::Item, Option<(Self::Item, Self::Item)>>
where + Self: Sized, + Self::Item: PartialEq,

If there are elements and they are all equal, return a single copy of that element. +If there are no elements, return an Error containing None. +If there are elements and they are not all equal, return a tuple containing the first +two non-equal elements found. Read more
§

fn all_unique(&mut self) -> bool
where + Self: Sized, + Self::Item: Eq + Hash,

Check whether all elements are unique (non equal). Read more
§

fn dropping(self, n: usize) -> Self
where + Self: Sized,

Consume the first n elements from the iterator eagerly, +and return the same iterator again. Read more
§

fn dropping_back(self, n: usize) -> Self
where + Self: Sized + DoubleEndedIterator,

Consume the last n elements from the iterator eagerly, +and return the same iterator again. Read more
§

fn foreach<F>(self, f: F)
where + F: FnMut(Self::Item), + Self: Sized,

👎Deprecated since 0.8.0: Use .for_each() instead
Run the closure f eagerly on each element of the iterator. Read more
§

fn concat(self) -> Self::Item
where + Self: Sized, + Self::Item: Extend<<Self::Item as IntoIterator>::Item> + IntoIterator + Default,

Combine all an iterator’s elements into one element by using Extend. Read more
§

fn collect_vec(self) -> Vec<Self::Item>
where + Self: Sized,

.collect_vec() is simply a type specialization of Iterator::collect, +for convenience.
§

fn try_collect<T, U, E>(self) -> Result<U, E>
where + Self: Sized + Iterator<Item = Result<T, E>>, + Result<U, E>: FromIterator<Result<T, E>>,

.try_collect() is more convenient way of writing +.collect::<Result<_, _>>() Read more
§

fn set_from<'a, A, J>(&mut self, from: J) -> usize
where + A: 'a, + Self: Iterator<Item = &'a mut A>, + J: IntoIterator<Item = A>,

Assign to each reference in self from the from iterator, +stopping at the shortest of the two iterators. Read more
§

fn join(&mut self, sep: &str) -> String
where + Self::Item: Display,

Combine all iterator elements into one String, separated by sep. Read more
§

fn format(self, sep: &str) -> Format<'_, Self>
where + Self: Sized,

Format all iterator elements, separated by sep. Read more
§

fn format_with<F>(self, sep: &str, format: F) -> FormatWith<'_, Self, F>
where + Self: Sized, + F: FnMut(Self::Item, &mut dyn FnMut(&dyn Display) -> Result<(), Error>) -> Result<(), Error>,

Format all iterator elements, separated by sep. Read more
§

fn fold_results<A, E, B, F>(&mut self, start: B, f: F) -> Result<B, E>
where + Self: Iterator<Item = Result<A, E>>, + F: FnMut(B, A) -> B,

👎Deprecated since 0.10.0: Use .fold_ok() instead
§

fn fold_ok<A, E, B, F>(&mut self, start: B, f: F) -> Result<B, E>
where + Self: Iterator<Item = Result<A, E>>, + F: FnMut(B, A) -> B,

Fold Result values from an iterator. Read more
§

fn fold_options<A, B, F>(&mut self, start: B, f: F) -> Option<B>
where + Self: Iterator<Item = Option<A>>, + F: FnMut(B, A) -> B,

Fold Option values from an iterator. Read more
§

fn fold1<F>(self, f: F) -> Option<Self::Item>
where + F: FnMut(Self::Item, Self::Item) -> Self::Item, + Self: Sized,

👎Deprecated since 0.10.2: Use Iterator::reduce instead
Accumulator of the elements in the iterator. Read more
§

fn tree_fold1<F>(self, f: F) -> Option<Self::Item>
where + F: FnMut(Self::Item, Self::Item) -> Self::Item, + Self: Sized,

Accumulate the elements in the iterator in a tree-like manner. Read more
§

fn fold_while<B, F>(&mut self, init: B, f: F) -> FoldWhile<B>
where + Self: Sized, + F: FnMut(B, Self::Item) -> FoldWhile<B>,

An iterator method that applies a function, producing a single, final value. Read more
§

fn sum1<S>(self) -> Option<S>
where + Self: Sized, + S: Sum<Self::Item>,

Iterate over the entire iterator and add all the elements. Read more
§

fn product1<P>(self) -> Option<P>
where + Self: Sized, + P: Product<Self::Item>,

Iterate over the entire iterator and multiply all the elements. Read more
§

fn sorted_unstable(self) -> IntoIter<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_unstable_by<F>(self, cmp: F) -> IntoIter<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_unstable_by_key<K, F>(self, f: F) -> IntoIter<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted(self) -> IntoIter<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_by<F>(self, cmp: F) -> IntoIter<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_by_key<K, F>(self, f: F) -> IntoIter<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_by_cached_key<K, F>(self, f: F) -> IntoIter<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Sort all iterator elements into a new iterator in ascending order. The key function is +called exactly once per key. Read more
§

fn k_smallest(self, k: usize) -> IntoIter<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Sort the k smallest elements into a new iterator, in ascending order. Read more
§

fn partition_map<A, B, F, L, R>(self, predicate: F) -> (A, B)
where + Self: Sized, + F: FnMut(Self::Item) -> Either<L, R>, + A: Default + Extend<L>, + B: Default + Extend<R>,

Collect all iterator elements into one of two +partitions. Unlike Iterator::partition, each partition may +have a distinct type. Read more
§

fn partition_result<A, B, T, E>(self) -> (A, B)
where + Self: Sized + Iterator<Item = Result<T, E>>, + A: Default + Extend<T>, + B: Default + Extend<E>,

Partition a sequence of Results into one list of all the Ok elements +and another list of all the Err elements. Read more
§

fn into_group_map<K, V>(self) -> HashMap<K, Vec<V>>
where + Self: Sized + Iterator<Item = (K, V)>, + K: Hash + Eq,

Return a HashMap of keys mapped to Vecs of values. Keys and values +are taken from (Key, Value) tuple pairs yielded by the input iterator. Read more
§

fn into_group_map_by<K, V, F>(self, f: F) -> HashMap<K, Vec<V>>
where + Self: Sized + Iterator<Item = V>, + K: Hash + Eq, + F: Fn(&V) -> K,

Return an Iterator on a HashMap. Keys mapped to Vecs of values. The key is specified +in the closure. Read more
§

fn into_grouping_map<K, V>(self) -> GroupingMap<Self>
where + Self: Sized + Iterator<Item = (K, V)>, + K: Hash + Eq,

Constructs a GroupingMap to be used later with one of the efficient +group-and-fold operations it allows to perform. Read more
§

fn into_grouping_map_by<K, V, F>( + self, + key_mapper: F +) -> GroupingMap<MapForGrouping<Self, F>>
where + Self: Sized + Iterator<Item = V>, + K: Hash + Eq, + F: FnMut(&V) -> K,

Constructs a GroupingMap to be used later with one of the efficient +group-and-fold operations it allows to perform. Read more
§

fn min_set(self) -> Vec<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Return all minimum elements of an iterator. Read more
§

fn min_set_by<F>(self, compare: F) -> Vec<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return all minimum elements of an iterator, as determined by +the specified function. Read more
§

fn min_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return all minimum elements of an iterator, as determined by +the specified function. Read more
§

fn max_set(self) -> Vec<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Return all maximum elements of an iterator. Read more
§

fn max_set_by<F>(self, compare: F) -> Vec<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return all maximum elements of an iterator, as determined by +the specified function. Read more
§

fn max_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return all maximum elements of an iterator, as determined by +the specified function. Read more
§

fn minmax(self) -> MinMaxResult<Self::Item>
where + Self: Sized, + Self::Item: PartialOrd,

Return the minimum and maximum elements in the iterator. Read more
§

fn minmax_by_key<K, F>(self, key: F) -> MinMaxResult<Self::Item>
where + Self: Sized, + K: PartialOrd, + F: FnMut(&Self::Item) -> K,

Return the minimum and maximum element of an iterator, as determined by +the specified function. Read more
§

fn minmax_by<F>(self, compare: F) -> MinMaxResult<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the minimum and maximum element of an iterator, as determined by +the specified comparison function. Read more
§

fn position_max(self) -> Option<usize>
where + Self: Sized, + Self::Item: Ord,

Return the position of the maximum element in the iterator. Read more
§

fn position_max_by_key<K, F>(self, key: F) -> Option<usize>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return the position of the maximum element in the iterator, as +determined by the specified function. Read more
§

fn position_max_by<F>(self, compare: F) -> Option<usize>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the position of the maximum element in the iterator, as +determined by the specified comparison function. Read more
§

fn position_min(self) -> Option<usize>
where + Self: Sized, + Self::Item: Ord,

Return the position of the minimum element in the iterator. Read more
§

fn position_min_by_key<K, F>(self, key: F) -> Option<usize>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return the position of the minimum element in the iterator, as +determined by the specified function. Read more
§

fn position_min_by<F>(self, compare: F) -> Option<usize>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the position of the minimum element in the iterator, as +determined by the specified comparison function. Read more
§

fn position_minmax(self) -> MinMaxResult<usize>
where + Self: Sized, + Self::Item: PartialOrd,

Return the positions of the minimum and maximum elements in +the iterator. Read more
§

fn position_minmax_by_key<K, F>(self, key: F) -> MinMaxResult<usize>
where + Self: Sized, + K: PartialOrd, + F: FnMut(&Self::Item) -> K,

Return the postions of the minimum and maximum elements of an +iterator, as determined by the specified function. Read more
§

fn position_minmax_by<F>(self, compare: F) -> MinMaxResult<usize>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the postions of the minimum and maximum elements of an +iterator, as determined by the specified comparison function. Read more
§

fn exactly_one(self) -> Result<Self::Item, ExactlyOneError<Self>>
where + Self: Sized,

If the iterator yields exactly one element, that element will be returned, otherwise +an error will be returned containing an iterator that has the same output as the input +iterator. Read more
§

fn at_most_one(self) -> Result<Option<Self::Item>, ExactlyOneError<Self>>
where + Self: Sized,

If the iterator yields no elements, Ok(None) will be returned. If the iterator yields +exactly one element, that element will be returned, otherwise an error will be returned +containing an iterator that has the same output as the input iterator. Read more
§

fn multipeek(self) -> MultiPeek<Self>
where + Self: Sized,

An iterator adaptor that allows the user to peek at multiple .next() +values without advancing the base iterator. Read more
§

fn counts(self) -> HashMap<Self::Item, usize>
where + Self: Sized, + Self::Item: Eq + Hash,

Collect the items in this iterator and return a HashMap which +contains each item that appears in the iterator and the number +of times it appears. Read more
§

fn counts_by<K, F>(self, f: F) -> HashMap<K, usize>
where + Self: Sized, + K: Eq + Hash, + F: FnMut(Self::Item) -> K,

Collect the items in this iterator and return a HashMap which +contains each item that appears in the iterator and the number +of times it appears, +determining identity using a keying function. Read more
§

fn multiunzip<FromI>(self) -> FromI
where + Self: Sized + MultiUnzip<FromI>,

Converts an iterator of tuples into a tuple of containers. Read more
§

fn try_len(&self) -> Result<usize, (usize, Option<usize>)>

Returns the length of the iterator if one exists. +Otherwise return self.size_hint(). Read more
§

impl<T> ParallelBridge for T
where + T: Iterator + Send, + <T as Iterator>::Item: Send,

§

fn par_bridge(self) -> IterBridge<T>

Creates a bridge from this type to a ParallelIterator.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/core/struct.Move.html b/docs/pabi/chess/core/struct.Move.html new file mode 100644 index 00000000..5f1c8348 --- /dev/null +++ b/docs/pabi/chess/core/struct.Move.html @@ -0,0 +1,37 @@ +Move in pabi::chess::core - Rust +

Struct pabi::chess::core::Move

source ·
pub struct Move {
+    pub(super) from: Square,
+    pub(super) to: Square,
+    pub(super) promotion: Option<Promotion>,
+}
Expand description

Represents any kind of a legal chess move. A move is the only way to mutate +crate::chess::position::Position and change the board state. Moves are +not sorted according to their potential “value” by the move generator. The +move representation has one-to-one correspondence with the UCI move +representation. The moves can also be indexed and fed as an input to the +Neural Network evaluators that would be able assess their potential without +evaluating post-states.

+

For a move to be serialized in Standard Algebraic Notation (SAN), it also +also requires the crate::chess::position::Position it will be applied +in, because SAN requires additional flags (e.g. indicating +“check”/“checkmate” or moving piece disambiguation).

+

Fields§

§from: Square§to: Square§promotion: Option<Promotion>

Implementations§

source§

impl Move

source

pub const fn new(from: Square, to: Square, promotion: Option<Promotion>) -> Self

source

pub fn from_san(_position: &Position) -> Self

Trait Implementations§

source§

impl Clone for Move

source§

fn clone(&self) -> Move

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Move

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Move

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Serializes a move in UCI format.

+
source§

impl Copy for Move

Auto Trait Implementations§

§

impl Freeze for Move

§

impl RefUnwindSafe for Move

§

impl Send for Move

§

impl Sync for Move

§

impl Unpin for Move

§

impl UnwindSafe for Move

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where + T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/core/struct.Piece.html b/docs/pabi/chess/core/struct.Piece.html new file mode 100644 index 00000000..7f045d6a --- /dev/null +++ b/docs/pabi/chess/core/struct.Piece.html @@ -0,0 +1,24 @@ +Piece in pabi::chess::core - Rust +

Struct pabi::chess::core::Piece

source ·
pub struct Piece {
+    pub owner: Player,
+    pub kind: PieceKind,
+}
Expand description

Represents a specific piece owned by a player.

+

Fields§

§owner: Player§kind: PieceKind

Trait Implementations§

source§

impl Display for Piece

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl TryFrom<char> for Piece

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(symbol: char) -> Result<Self>

Performs the conversion.

Auto Trait Implementations§

§

impl Freeze for Piece

§

impl RefUnwindSafe for Piece

§

impl Send for Piece

§

impl Sync for Piece

§

impl Unpin for Piece

§

impl UnwindSafe for Piece

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToString for T
where + T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/core/struct.RankIter.html b/docs/pabi/chess/core/struct.RankIter.html new file mode 100644 index 00000000..ffcf3dc4 --- /dev/null +++ b/docs/pabi/chess/core/struct.RankIter.html @@ -0,0 +1,636 @@ +RankIter in pabi::chess::core - Rust +

Struct pabi::chess::core::RankIter

source ·
pub struct RankIter {
+    idx: usize,
+    back_idx: usize,
+    marker: PhantomData<()>,
+}
Expand description

An iterator over the variants of Rank

+

Fields§

§idx: usize§back_idx: usize§marker: PhantomData<()>

Implementations§

source§

impl RankIter

source

fn get(&self, idx: usize) -> Option<Rank>

Trait Implementations§

source§

impl Clone for RankIter

source§

fn clone(&self) -> RankIter

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for RankIter

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl DoubleEndedIterator for RankIter

source§

fn next_back(&mut self) -> Option<<Self as Iterator>::Item>

Removes and returns an element from the end of the iterator. Read more
source§

fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator from the back by n elements. Read more
1.37.0 · source§

fn nth_back(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element from the end of the iterator. Read more
1.27.0 · source§

fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

This is the reverse version of Iterator::try_fold(): it takes +elements starting from the back of the iterator. Read more
1.27.0 · source§

fn rfold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

An iterator method that reduces the iterator’s elements to a single, +final value, starting from the back. Read more
1.27.0 · source§

fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator from the back that satisfies a predicate. Read more
source§

impl ExactSizeIterator for RankIter

source§

fn len(&self) -> usize

Returns the exact remaining length of the iterator. Read more
source§

fn is_empty(&self) -> bool

🔬This is a nightly-only experimental API. (exact_size_is_empty)
Returns true if the iterator is empty. Read more
source§

impl Iterator for RankIter

§

type Item = Rank

The type of the elements being iterated over.
source§

fn next(&mut self) -> Option<<Self as Iterator>::Item>

Advances the iterator and returns the next value. Read more
source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
source§

fn nth(&mut self, n: usize) -> Option<<Self as Iterator>::Item>

Returns the nth element of the iterator. Read more
source§

fn next_chunk<const N: usize>( + &mut self +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · source§

fn count(self) -> usize
where + Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 · source§

fn last(self) -> Option<Self::Item>
where + Self: Sized,

Consumes the iterator, returning the last element. Read more
source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.28.0 · source§

fn step_by(self, step: usize) -> StepBy<Self>
where + Self: Sized,

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
1.0.0 · source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where + Self: Sized, + Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more
source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where + Self: Sized, + G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
1.0.0 · source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each +element. Read more
1.21.0 · source§

fn for_each<F>(self, f: F)
where + Self: Sized, + F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
1.0.0 · source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · source§

fn enumerate(self) -> Enumerate<Self>
where + Self: Sized,

Creates an iterator which gives the current iteration count as well as +the next value. Read more
1.0.0 · source§

fn peekable(self) -> Peekable<Self>
where + Self: Sized,

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more
1.0.0 · source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · source§

fn skip(self, n: usize) -> Skip<Self>
where + Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · source§

fn take(self, n: usize) -> Take<Self>
where + Self: Sized,

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
1.0.0 · source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
1.0.0 · source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where + Self: Sized, + F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over +self and returns an iterator over the outputs of f. Like slice::windows(), +the windows during mapping overlap as well. Read more
1.0.0 · source§

fn fuse(self) -> Fuse<Self>
where + Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · source§

fn by_ref(&mut self) -> &mut Self
where + Self: Sized,

Borrows an iterator, rather than consuming it. Read more
1.0.0 · source§

fn collect<B>(self) -> B
where + B: FromIterator<Self::Item>, + Self: Sized,

Transforms an iterator into a collection. Read more
source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where + E: Extend<Self::Item>, + Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · source§

fn partition<B, F>(self, f: F) -> (B, B)
where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
source§

fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
where + T: 'a, + Self: Sized + DoubleEndedIterator<Item = &'a mut T>, + P: FnMut(&T) -> bool,

🔬This is a nightly-only experimental API. (iter_partition_in_place)
Reorders the elements of this iterator in-place according to the given predicate, +such that all those that return true precede all those that return false. +Returns the number of true elements found. Read more
source§

fn is_partitioned<P>(self, predicate: P) -> bool
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
1.27.0 · source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
1.27.0 · source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
1.0.0 · source§

fn fold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, +returning the final result. Read more
1.51.0 · source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
source§

fn try_reduce<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> R, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · source§

fn all<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · source§

fn any<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns +the first non-none result. Read more
source§

fn try_find<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where + Self: Sized, + F: FnMut(&Self::Item) -> R, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
1.0.0 · source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.0.0 · source§

fn rposition<P>(&mut self, predicate: P) -> Option<usize>
where + P: FnMut(Self::Item) -> bool, + Self: Sized + ExactSizeIterator + DoubleEndedIterator,

Searches for an element in an iterator from the right, returning its +index. Read more
1.0.0 · source§

fn max(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the maximum element of an iterator. Read more
1.0.0 · source§

fn min(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the minimum element of an iterator. Read more
1.6.0 · source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the +specified function. Read more
1.15.0 · source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
1.6.0 · source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the +specified function. Read more
1.15.0 · source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
1.0.0 · source§

fn rev(self) -> Rev<Self>
where + Self: Sized + DoubleEndedIterator,

Reverses an iterator’s direction. Read more
1.0.0 · source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · source§

fn copied<'a, T>(self) -> Copied<Self>
where + T: 'a + Copy, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · source§

fn cloned<'a, T>(self) -> Cloned<Self>
where + T: 'a + Clone, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
1.0.0 · source§

fn cycle(self) -> Cycle<Self>
where + Self: Sized + Clone,

Repeats an iterator endlessly. Read more
source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · source§

fn sum<S>(self) -> S
where + Self: Sized, + S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · source§

fn product<P>(self) -> P
where + Self: Sized, + P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
1.5.0 · source§

fn cmp<I>(self, other: I) -> Ordering
where + I: IntoIterator<Item = Self::Item>, + Self::Item: Ord, + Self: Sized,

Lexicographically compares the elements of this Iterator with those +of another. Read more
source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · source§

fn eq<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are equal to those of +another. Read more
source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
1.5.0 · source§

fn ne<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are not equal to those of +another. Read more
1.5.0 · source§

fn lt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
1.5.0 · source§

fn le<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
1.5.0 · source§

fn gt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
1.5.0 · source§

fn ge<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
source§

fn is_sorted(self) -> bool
where + Self: Sized, + Self::Item: PartialOrd,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted. Read more
source§

fn is_sorted_by<F>(self, compare: F) -> bool
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> bool,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given comparator function. Read more
source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given key extraction +function. Read more
source§

impl FusedIterator for RankIter

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

impl<I> IntoIterator for I
where + I: Iterator,

§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
§

type IntoIter = I

Which kind of iterator are we turning this into?
const: unstable · source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
§

impl<T> Itertools for T
where + T: Iterator + ?Sized,

§

fn interleave<J>( + self, + other: J +) -> Interleave<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator<Item = Self::Item>, + Self: Sized,

Alternate elements from two iterators until both have run out. Read more
§

fn interleave_shortest<J>( + self, + other: J +) -> InterleaveShortest<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator<Item = Self::Item>, + Self: Sized,

Alternate elements from two iterators until at least one of them has run +out. Read more
§

fn intersperse( + self, + element: Self::Item +) -> IntersperseWith<Self, IntersperseElementSimple<Self::Item>>
where + Self: Sized, + Self::Item: Clone,

An iterator adaptor to insert a particular value +between each element of the adapted iterator. Read more
§

fn intersperse_with<F>(self, element: F) -> IntersperseWith<Self, F>
where + Self: Sized, + F: FnMut() -> Self::Item,

An iterator adaptor to insert a particular value created by a function +between each element of the adapted iterator. Read more
§

fn zip_longest<J>( + self, + other: J +) -> ZipLongest<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator, + Self: Sized,

Create an iterator which iterates over both this and the specified +iterator simultaneously, yielding pairs of two optional elements. Read more
§

fn zip_eq<J>(self, other: J) -> ZipEq<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator, + Self: Sized,

Create an iterator which iterates over both this and the specified +iterator simultaneously, yielding pairs of elements. Read more
§

fn batching<B, F>(self, f: F) -> Batching<Self, F>
where + F: FnMut(&mut Self) -> Option<B>, + Self: Sized,

A “meta iterator adaptor”. Its closure receives a reference to the +iterator and may pick off as many elements as it likes, to produce the +next iterator element. Read more
§

fn group_by<K, F>(self, key: F) -> GroupBy<K, Self, F>
where + Self: Sized, + F: FnMut(&Self::Item) -> K, + K: PartialEq,

Return an iterable that can group iterator elements. +Consecutive elements that map to the same key (“runs”), are assigned +to the same group. Read more
§

fn chunks(self, size: usize) -> IntoChunks<Self>
where + Self: Sized,

Return an iterable that can chunk the iterator. Read more
§

fn tuple_windows<T>(self) -> TupleWindows<Self, T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple, + <T as TupleCollect>::Item: Clone,

Return an iterator over all contiguous windows producing tuples of +a specific size (up to 12). Read more
§

fn circular_tuple_windows<T>(self) -> CircularTupleWindows<Self, T>
where + Self: Sized + Clone + Iterator<Item = <T as TupleCollect>::Item> + ExactSizeIterator, + T: TupleCollect + Clone, + <T as TupleCollect>::Item: Clone,

Return an iterator over all windows, wrapping back to the first +elements when the window would otherwise exceed the length of the +iterator, producing tuples of a specific size (up to 12). Read more
§

fn tuples<T>(self) -> Tuples<Self, T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple,

Return an iterator that groups the items in tuples of a specific size +(up to 12). Read more
§

fn tee(self) -> (Tee<Self>, Tee<Self>)
where + Self: Sized, + Self::Item: Clone,

Split into an iterator pair that both yield all elements from +the original iterator. Read more
§

fn step(self, n: usize) -> Step<Self>
where + Self: Sized,

👎Deprecated since 0.8.0: Use std .step_by() instead
Return an iterator adaptor that steps n elements in the base iterator +for each iteration. Read more
§

fn map_into<R>(self) -> MapSpecialCase<Self, MapSpecialCaseFnInto<R>>
where + Self: Sized, + Self::Item: Into<R>,

Convert each item of the iterator using the Into trait. Read more
§

fn map_results<F, T, U, E>( + self, + f: F +) -> MapSpecialCase<Self, MapSpecialCaseFnOk<F>>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(T) -> U,

👎Deprecated since 0.10.0: Use .map_ok() instead
§

fn map_ok<F, T, U, E>(self, f: F) -> MapSpecialCase<Self, MapSpecialCaseFnOk<F>>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(T) -> U,

Return an iterator adaptor that applies the provided closure +to every Result::Ok value. Result::Err values are +unchanged. Read more
§

fn filter_ok<F, T, E>(self, f: F) -> FilterOk<Self, F>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(&T) -> bool,

Return an iterator adaptor that filters every Result::Ok +value with the provided closure. Result::Err values are +unchanged. Read more
§

fn filter_map_ok<F, T, U, E>(self, f: F) -> FilterMapOk<Self, F>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(T) -> Option<U>,

Return an iterator adaptor that filters and transforms every +Result::Ok value with the provided closure. Result::Err +values are unchanged. Read more
§

fn flatten_ok<T, E>(self) -> FlattenOk<Self, T, E>
where + Self: Sized + Iterator<Item = Result<T, E>>, + T: IntoIterator,

Return an iterator adaptor that flattens every Result::Ok value into +a series of Result::Ok values. Result::Err values are unchanged. Read more
§

fn process_results<F, T, E, R>(self, processor: F) -> Result<R, E>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnOnce(ProcessResults<'_, Self, E>) -> R,

“Lift” a function of the values of the current iterator so as to process +an iterator of Result values instead. Read more
§

fn merge<J>( + self, + other: J +) -> MergeBy<Self, <J as IntoIterator>::IntoIter, MergeLte>
where + Self: Sized, + Self::Item: PartialOrd, + J: IntoIterator<Item = Self::Item>,

Return an iterator adaptor that merges the two base iterators in +ascending order. If both base iterators are sorted (ascending), the +result is sorted. Read more
§

fn merge_by<J, F>( + self, + other: J, + is_first: F +) -> MergeBy<Self, <J as IntoIterator>::IntoIter, F>
where + Self: Sized, + J: IntoIterator<Item = Self::Item>, + F: FnMut(&Self::Item, &Self::Item) -> bool,

Return an iterator adaptor that merges the two base iterators in order. +This is much like .merge() but allows for a custom ordering. Read more
§

fn merge_join_by<J, F, T>( + self, + other: J, + cmp_fn: F +) -> MergeBy<Self, <J as IntoIterator>::IntoIter, MergeFuncLR<F, <F as FuncLR<Self::Item, <<J as IntoIterator>::IntoIter as Iterator>::Item>>::T>>
where + J: IntoIterator, + F: FnMut(&Self::Item, &<J as IntoIterator>::Item) -> T, + Self: Sized,

Create an iterator that merges items from both this and the specified +iterator in ascending order. Read more
§

fn kmerge(self) -> KMergeBy<<Self::Item as IntoIterator>::IntoIter, KMergeByLt>
where + Self: Sized, + Self::Item: IntoIterator, + <Self::Item as IntoIterator>::Item: PartialOrd,

Return an iterator adaptor that flattens an iterator of iterators by +merging them in ascending order. Read more
§

fn kmerge_by<F>( + self, + first: F +) -> KMergeBy<<Self::Item as IntoIterator>::IntoIter, F>
where + Self: Sized, + Self::Item: IntoIterator, + F: FnMut(&<Self::Item as IntoIterator>::Item, &<Self::Item as IntoIterator>::Item) -> bool,

Return an iterator adaptor that flattens an iterator of iterators by +merging them according to the given closure. Read more
§

fn cartesian_product<J>( + self, + other: J +) -> Product<Self, <J as IntoIterator>::IntoIter>
where + Self: Sized, + Self::Item: Clone, + J: IntoIterator, + <J as IntoIterator>::IntoIter: Clone,

Return an iterator adaptor that iterates over the cartesian product of +the element sets of two iterators self and J. Read more
§

fn multi_cartesian_product( + self +) -> MultiProduct<<Self::Item as IntoIterator>::IntoIter>
where + Self: Sized, + Self::Item: IntoIterator, + <Self::Item as IntoIterator>::IntoIter: Clone, + <Self::Item as IntoIterator>::Item: Clone,

Return an iterator adaptor that iterates over the cartesian product of +all subiterators returned by meta-iterator self. Read more
§

fn coalesce<F>(self, f: F) -> CoalesceBy<Self, F, NoCount>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Result<Self::Item, (Self::Item, Self::Item)>,

Return an iterator adaptor that uses the passed-in closure to +optionally merge together consecutive elements. Read more
§

fn dedup(self) -> CoalesceBy<Self, DedupPred2CoalescePred<DedupEq>, NoCount>
where + Self: Sized, + Self::Item: PartialEq,

Remove duplicates from sections of consecutive identical elements. +If the iterator is sorted, all elements will be unique. Read more
§

fn dedup_by<Cmp>( + self, + cmp: Cmp +) -> CoalesceBy<Self, DedupPred2CoalescePred<Cmp>, NoCount>
where + Self: Sized, + Cmp: FnMut(&Self::Item, &Self::Item) -> bool,

Remove duplicates from sections of consecutive identical elements, +determining equality using a comparison function. +If the iterator is sorted, all elements will be unique. Read more
§

fn dedup_with_count( + self +) -> CoalesceBy<Self, DedupPredWithCount2CoalescePred<DedupEq>, WithCount>
where + Self: Sized,

Remove duplicates from sections of consecutive identical elements, while keeping a count of +how many repeated elements were present. +If the iterator is sorted, all elements will be unique. Read more
§

fn dedup_by_with_count<Cmp>( + self, + cmp: Cmp +) -> CoalesceBy<Self, DedupPredWithCount2CoalescePred<Cmp>, WithCount>
where + Self: Sized, + Cmp: FnMut(&Self::Item, &Self::Item) -> bool,

Remove duplicates from sections of consecutive identical elements, while keeping a count of +how many repeated elements were present. +This will determine equality using a comparison function. +If the iterator is sorted, all elements will be unique. Read more
§

fn duplicates(self) -> DuplicatesBy<Self, Self::Item, ById>
where + Self: Sized, + Self::Item: Eq + Hash,

Return an iterator adaptor that produces elements that appear more than once during the +iteration. Duplicates are detected using hash and equality. Read more
§

fn duplicates_by<V, F>(self, f: F) -> DuplicatesBy<Self, V, ByFn<F>>
where + Self: Sized, + V: Eq + Hash, + F: FnMut(&Self::Item) -> V,

Return an iterator adaptor that produces elements that appear more than once during the +iteration. Duplicates are detected using hash and equality. Read more
§

fn unique(self) -> Unique<Self>
where + Self: Sized, + Self::Item: Clone + Eq + Hash,

Return an iterator adaptor that filters out elements that have +already been produced once during the iteration. Duplicates +are detected using hash and equality. Read more
§

fn unique_by<V, F>(self, f: F) -> UniqueBy<Self, V, F>
where + Self: Sized, + V: Eq + Hash, + F: FnMut(&Self::Item) -> V,

Return an iterator adaptor that filters out elements that have +already been produced once during the iteration. Read more
§

fn peeking_take_while<F>(&mut self, accept: F) -> PeekingTakeWhile<'_, Self, F>
where + Self: Sized + PeekingNext, + F: FnMut(&Self::Item) -> bool,

Return an iterator adaptor that borrows from this iterator and +takes items while the closure accept returns true. Read more
§

fn take_while_ref<F>(&mut self, accept: F) -> TakeWhileRef<'_, Self, F>
where + Self: Clone, + F: FnMut(&Self::Item) -> bool,

Return an iterator adaptor that borrows from a Clone-able iterator +to only pick off elements while the predicate accept returns true. Read more
§

fn take_while_inclusive<F>(self, accept: F) -> TakeWhileInclusive<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item) -> bool,

Returns an iterator adaptor that consumes elements while the given +predicate is true, including the element for which the predicate +first returned false. Read more
§

fn while_some<A>(self) -> WhileSome<Self>
where + Self: Sized + Iterator<Item = Option<A>>,

Return an iterator adaptor that filters Option<A> iterator elements +and produces A. Stops on the first None encountered. Read more
§

fn tuple_combinations<T>(self) -> TupleCombinations<Self, T>
where + Self: Sized + Clone, + Self::Item: Clone, + T: HasCombination<Self>,

Return an iterator adaptor that iterates over the combinations of the +elements from an iterator. Read more
§

fn combinations(self, k: usize) -> Combinations<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator adaptor that iterates over the k-length combinations of +the elements from an iterator. Read more
§

fn combinations_with_replacement( + self, + k: usize +) -> CombinationsWithReplacement<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator that iterates over the k-length combinations of +the elements from an iterator, with replacement. Read more
§

fn permutations(self, k: usize) -> Permutations<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator adaptor that iterates over all k-permutations of the +elements from an iterator. Read more
§

fn powerset(self) -> Powerset<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator that iterates through the powerset of the elements from an +iterator. Read more
§

fn pad_using<F>(self, min: usize, f: F) -> PadUsing<Self, F>
where + Self: Sized, + F: FnMut(usize) -> Self::Item,

Return an iterator adaptor that pads the sequence to a minimum length of +min by filling missing elements using a closure f. Read more
§

fn with_position(self) -> WithPosition<Self>
where + Self: Sized,

Return an iterator adaptor that combines each element with a Position to +ease special-case handling of the first or last elements. Read more
§

fn positions<P>(self, predicate: P) -> Positions<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Return an iterator adaptor that yields the indices of all elements +satisfying a predicate, counted from the start of the iterator. Read more
§

fn update<F>(self, updater: F) -> Update<Self, F>
where + Self: Sized, + F: FnMut(&mut Self::Item),

Return an iterator adaptor that applies a mutating function +to each element before yielding it. Read more
§

fn next_tuple<T>(&mut self) -> Option<T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple,

Advances the iterator and returns the next items grouped in a tuple of +a specific size (up to 12). Read more
§

fn collect_tuple<T>(self) -> Option<T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple,

Collects all items from the iterator into a tuple of a specific size +(up to 12). Read more
§

fn find_position<P>(&mut self, pred: P) -> Option<(usize, Self::Item)>
where + P: FnMut(&Self::Item) -> bool,

Find the position and value of the first element satisfying a predicate. Read more
§

fn find_or_last<P>(self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Find the value of the first element satisfying a predicate or return the last element, if any. Read more
§

fn find_or_first<P>(self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Find the value of the first element satisfying a predicate or return the first element, if any. Read more
§

fn contains<Q>(&mut self, query: &Q) -> bool
where + Self: Sized, + Self::Item: Borrow<Q>, + Q: PartialEq,

Returns true if the given item is present in this iterator. Read more
§

fn all_equal(&mut self) -> bool
where + Self: Sized, + Self::Item: PartialEq,

Check whether all elements compare equal. Read more
§

fn all_equal_value( + &mut self +) -> Result<Self::Item, Option<(Self::Item, Self::Item)>>
where + Self: Sized, + Self::Item: PartialEq,

If there are elements and they are all equal, return a single copy of that element. +If there are no elements, return an Error containing None. +If there are elements and they are not all equal, return a tuple containing the first +two non-equal elements found. Read more
§

fn all_unique(&mut self) -> bool
where + Self: Sized, + Self::Item: Eq + Hash,

Check whether all elements are unique (non equal). Read more
§

fn dropping(self, n: usize) -> Self
where + Self: Sized,

Consume the first n elements from the iterator eagerly, +and return the same iterator again. Read more
§

fn dropping_back(self, n: usize) -> Self
where + Self: Sized + DoubleEndedIterator,

Consume the last n elements from the iterator eagerly, +and return the same iterator again. Read more
§

fn foreach<F>(self, f: F)
where + F: FnMut(Self::Item), + Self: Sized,

👎Deprecated since 0.8.0: Use .for_each() instead
Run the closure f eagerly on each element of the iterator. Read more
§

fn concat(self) -> Self::Item
where + Self: Sized, + Self::Item: Extend<<Self::Item as IntoIterator>::Item> + IntoIterator + Default,

Combine all an iterator’s elements into one element by using Extend. Read more
§

fn collect_vec(self) -> Vec<Self::Item>
where + Self: Sized,

.collect_vec() is simply a type specialization of Iterator::collect, +for convenience.
§

fn try_collect<T, U, E>(self) -> Result<U, E>
where + Self: Sized + Iterator<Item = Result<T, E>>, + Result<U, E>: FromIterator<Result<T, E>>,

.try_collect() is more convenient way of writing +.collect::<Result<_, _>>() Read more
§

fn set_from<'a, A, J>(&mut self, from: J) -> usize
where + A: 'a, + Self: Iterator<Item = &'a mut A>, + J: IntoIterator<Item = A>,

Assign to each reference in self from the from iterator, +stopping at the shortest of the two iterators. Read more
§

fn join(&mut self, sep: &str) -> String
where + Self::Item: Display,

Combine all iterator elements into one String, separated by sep. Read more
§

fn format(self, sep: &str) -> Format<'_, Self>
where + Self: Sized,

Format all iterator elements, separated by sep. Read more
§

fn format_with<F>(self, sep: &str, format: F) -> FormatWith<'_, Self, F>
where + Self: Sized, + F: FnMut(Self::Item, &mut dyn FnMut(&dyn Display) -> Result<(), Error>) -> Result<(), Error>,

Format all iterator elements, separated by sep. Read more
§

fn fold_results<A, E, B, F>(&mut self, start: B, f: F) -> Result<B, E>
where + Self: Iterator<Item = Result<A, E>>, + F: FnMut(B, A) -> B,

👎Deprecated since 0.10.0: Use .fold_ok() instead
§

fn fold_ok<A, E, B, F>(&mut self, start: B, f: F) -> Result<B, E>
where + Self: Iterator<Item = Result<A, E>>, + F: FnMut(B, A) -> B,

Fold Result values from an iterator. Read more
§

fn fold_options<A, B, F>(&mut self, start: B, f: F) -> Option<B>
where + Self: Iterator<Item = Option<A>>, + F: FnMut(B, A) -> B,

Fold Option values from an iterator. Read more
§

fn fold1<F>(self, f: F) -> Option<Self::Item>
where + F: FnMut(Self::Item, Self::Item) -> Self::Item, + Self: Sized,

👎Deprecated since 0.10.2: Use Iterator::reduce instead
Accumulator of the elements in the iterator. Read more
§

fn tree_fold1<F>(self, f: F) -> Option<Self::Item>
where + F: FnMut(Self::Item, Self::Item) -> Self::Item, + Self: Sized,

Accumulate the elements in the iterator in a tree-like manner. Read more
§

fn fold_while<B, F>(&mut self, init: B, f: F) -> FoldWhile<B>
where + Self: Sized, + F: FnMut(B, Self::Item) -> FoldWhile<B>,

An iterator method that applies a function, producing a single, final value. Read more
§

fn sum1<S>(self) -> Option<S>
where + Self: Sized, + S: Sum<Self::Item>,

Iterate over the entire iterator and add all the elements. Read more
§

fn product1<P>(self) -> Option<P>
where + Self: Sized, + P: Product<Self::Item>,

Iterate over the entire iterator and multiply all the elements. Read more
§

fn sorted_unstable(self) -> IntoIter<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_unstable_by<F>(self, cmp: F) -> IntoIter<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_unstable_by_key<K, F>(self, f: F) -> IntoIter<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted(self) -> IntoIter<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_by<F>(self, cmp: F) -> IntoIter<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_by_key<K, F>(self, f: F) -> IntoIter<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_by_cached_key<K, F>(self, f: F) -> IntoIter<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Sort all iterator elements into a new iterator in ascending order. The key function is +called exactly once per key. Read more
§

fn k_smallest(self, k: usize) -> IntoIter<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Sort the k smallest elements into a new iterator, in ascending order. Read more
§

fn partition_map<A, B, F, L, R>(self, predicate: F) -> (A, B)
where + Self: Sized, + F: FnMut(Self::Item) -> Either<L, R>, + A: Default + Extend<L>, + B: Default + Extend<R>,

Collect all iterator elements into one of two +partitions. Unlike Iterator::partition, each partition may +have a distinct type. Read more
§

fn partition_result<A, B, T, E>(self) -> (A, B)
where + Self: Sized + Iterator<Item = Result<T, E>>, + A: Default + Extend<T>, + B: Default + Extend<E>,

Partition a sequence of Results into one list of all the Ok elements +and another list of all the Err elements. Read more
§

fn into_group_map<K, V>(self) -> HashMap<K, Vec<V>>
where + Self: Sized + Iterator<Item = (K, V)>, + K: Hash + Eq,

Return a HashMap of keys mapped to Vecs of values. Keys and values +are taken from (Key, Value) tuple pairs yielded by the input iterator. Read more
§

fn into_group_map_by<K, V, F>(self, f: F) -> HashMap<K, Vec<V>>
where + Self: Sized + Iterator<Item = V>, + K: Hash + Eq, + F: Fn(&V) -> K,

Return an Iterator on a HashMap. Keys mapped to Vecs of values. The key is specified +in the closure. Read more
§

fn into_grouping_map<K, V>(self) -> GroupingMap<Self>
where + Self: Sized + Iterator<Item = (K, V)>, + K: Hash + Eq,

Constructs a GroupingMap to be used later with one of the efficient +group-and-fold operations it allows to perform. Read more
§

fn into_grouping_map_by<K, V, F>( + self, + key_mapper: F +) -> GroupingMap<MapForGrouping<Self, F>>
where + Self: Sized + Iterator<Item = V>, + K: Hash + Eq, + F: FnMut(&V) -> K,

Constructs a GroupingMap to be used later with one of the efficient +group-and-fold operations it allows to perform. Read more
§

fn min_set(self) -> Vec<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Return all minimum elements of an iterator. Read more
§

fn min_set_by<F>(self, compare: F) -> Vec<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return all minimum elements of an iterator, as determined by +the specified function. Read more
§

fn min_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return all minimum elements of an iterator, as determined by +the specified function. Read more
§

fn max_set(self) -> Vec<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Return all maximum elements of an iterator. Read more
§

fn max_set_by<F>(self, compare: F) -> Vec<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return all maximum elements of an iterator, as determined by +the specified function. Read more
§

fn max_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return all maximum elements of an iterator, as determined by +the specified function. Read more
§

fn minmax(self) -> MinMaxResult<Self::Item>
where + Self: Sized, + Self::Item: PartialOrd,

Return the minimum and maximum elements in the iterator. Read more
§

fn minmax_by_key<K, F>(self, key: F) -> MinMaxResult<Self::Item>
where + Self: Sized, + K: PartialOrd, + F: FnMut(&Self::Item) -> K,

Return the minimum and maximum element of an iterator, as determined by +the specified function. Read more
§

fn minmax_by<F>(self, compare: F) -> MinMaxResult<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the minimum and maximum element of an iterator, as determined by +the specified comparison function. Read more
§

fn position_max(self) -> Option<usize>
where + Self: Sized, + Self::Item: Ord,

Return the position of the maximum element in the iterator. Read more
§

fn position_max_by_key<K, F>(self, key: F) -> Option<usize>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return the position of the maximum element in the iterator, as +determined by the specified function. Read more
§

fn position_max_by<F>(self, compare: F) -> Option<usize>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the position of the maximum element in the iterator, as +determined by the specified comparison function. Read more
§

fn position_min(self) -> Option<usize>
where + Self: Sized, + Self::Item: Ord,

Return the position of the minimum element in the iterator. Read more
§

fn position_min_by_key<K, F>(self, key: F) -> Option<usize>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return the position of the minimum element in the iterator, as +determined by the specified function. Read more
§

fn position_min_by<F>(self, compare: F) -> Option<usize>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the position of the minimum element in the iterator, as +determined by the specified comparison function. Read more
§

fn position_minmax(self) -> MinMaxResult<usize>
where + Self: Sized, + Self::Item: PartialOrd,

Return the positions of the minimum and maximum elements in +the iterator. Read more
§

fn position_minmax_by_key<K, F>(self, key: F) -> MinMaxResult<usize>
where + Self: Sized, + K: PartialOrd, + F: FnMut(&Self::Item) -> K,

Return the postions of the minimum and maximum elements of an +iterator, as determined by the specified function. Read more
§

fn position_minmax_by<F>(self, compare: F) -> MinMaxResult<usize>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the postions of the minimum and maximum elements of an +iterator, as determined by the specified comparison function. Read more
§

fn exactly_one(self) -> Result<Self::Item, ExactlyOneError<Self>>
where + Self: Sized,

If the iterator yields exactly one element, that element will be returned, otherwise +an error will be returned containing an iterator that has the same output as the input +iterator. Read more
§

fn at_most_one(self) -> Result<Option<Self::Item>, ExactlyOneError<Self>>
where + Self: Sized,

If the iterator yields no elements, Ok(None) will be returned. If the iterator yields +exactly one element, that element will be returned, otherwise an error will be returned +containing an iterator that has the same output as the input iterator. Read more
§

fn multipeek(self) -> MultiPeek<Self>
where + Self: Sized,

An iterator adaptor that allows the user to peek at multiple .next() +values without advancing the base iterator. Read more
§

fn counts(self) -> HashMap<Self::Item, usize>
where + Self: Sized, + Self::Item: Eq + Hash,

Collect the items in this iterator and return a HashMap which +contains each item that appears in the iterator and the number +of times it appears. Read more
§

fn counts_by<K, F>(self, f: F) -> HashMap<K, usize>
where + Self: Sized, + K: Eq + Hash, + F: FnMut(Self::Item) -> K,

Collect the items in this iterator and return a HashMap which +contains each item that appears in the iterator and the number +of times it appears, +determining identity using a keying function. Read more
§

fn multiunzip<FromI>(self) -> FromI
where + Self: Sized + MultiUnzip<FromI>,

Converts an iterator of tuples into a tuple of containers. Read more
§

fn try_len(&self) -> Result<usize, (usize, Option<usize>)>

Returns the length of the iterator if one exists. +Otherwise return self.size_hint(). Read more
§

impl<T> ParallelBridge for T
where + T: Iterator + Send, + <T as Iterator>::Item: Send,

§

fn par_bridge(self) -> IterBridge<T>

Creates a bridge from this type to a ParallelIterator.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/core/struct.SquareIter.html b/docs/pabi/chess/core/struct.SquareIter.html new file mode 100644 index 00000000..0c36ba88 --- /dev/null +++ b/docs/pabi/chess/core/struct.SquareIter.html @@ -0,0 +1,636 @@ +SquareIter in pabi::chess::core - Rust +

Struct pabi::chess::core::SquareIter

source ·
pub struct SquareIter {
+    idx: usize,
+    back_idx: usize,
+    marker: PhantomData<()>,
+}
Expand description

An iterator over the variants of Square

+

Fields§

§idx: usize§back_idx: usize§marker: PhantomData<()>

Implementations§

Trait Implementations§

source§

impl Clone for SquareIter

source§

fn clone(&self) -> SquareIter

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SquareIter

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl DoubleEndedIterator for SquareIter

source§

fn next_back(&mut self) -> Option<<Self as Iterator>::Item>

Removes and returns an element from the end of the iterator. Read more
source§

fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator from the back by n elements. Read more
1.37.0 · source§

fn nth_back(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element from the end of the iterator. Read more
1.27.0 · source§

fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

This is the reverse version of Iterator::try_fold(): it takes +elements starting from the back of the iterator. Read more
1.27.0 · source§

fn rfold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

An iterator method that reduces the iterator’s elements to a single, +final value, starting from the back. Read more
1.27.0 · source§

fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator from the back that satisfies a predicate. Read more
source§

impl ExactSizeIterator for SquareIter

source§

fn len(&self) -> usize

Returns the exact remaining length of the iterator. Read more
source§

fn is_empty(&self) -> bool

🔬This is a nightly-only experimental API. (exact_size_is_empty)
Returns true if the iterator is empty. Read more
source§

impl Iterator for SquareIter

§

type Item = Square

The type of the elements being iterated over.
source§

fn next(&mut self) -> Option<<Self as Iterator>::Item>

Advances the iterator and returns the next value. Read more
source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
source§

fn nth(&mut self, n: usize) -> Option<<Self as Iterator>::Item>

Returns the nth element of the iterator. Read more
source§

fn next_chunk<const N: usize>( + &mut self +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · source§

fn count(self) -> usize
where + Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 · source§

fn last(self) -> Option<Self::Item>
where + Self: Sized,

Consumes the iterator, returning the last element. Read more
source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.28.0 · source§

fn step_by(self, step: usize) -> StepBy<Self>
where + Self: Sized,

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
1.0.0 · source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where + Self: Sized, + U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where + Self: Sized, + Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more
source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where + Self: Sized, + G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
1.0.0 · source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each +element. Read more
1.21.0 · source§

fn for_each<F>(self, f: F)
where + Self: Sized, + F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
1.0.0 · source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · source§

fn enumerate(self) -> Enumerate<Self>
where + Self: Sized,

Creates an iterator which gives the current iteration count as well as +the next value. Read more
1.0.0 · source§

fn peekable(self) -> Peekable<Self>
where + Self: Sized,

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more
1.0.0 · source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · source§

fn skip(self, n: usize) -> Skip<Self>
where + Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · source§

fn take(self, n: usize) -> Take<Self>
where + Self: Sized,

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
1.0.0 · source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
1.0.0 · source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where + Self: Sized, + F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over +self and returns an iterator over the outputs of f. Like slice::windows(), +the windows during mapping overlap as well. Read more
1.0.0 · source§

fn fuse(self) -> Fuse<Self>
where + Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · source§

fn by_ref(&mut self) -> &mut Self
where + Self: Sized,

Borrows an iterator, rather than consuming it. Read more
1.0.0 · source§

fn collect<B>(self) -> B
where + B: FromIterator<Self::Item>, + Self: Sized,

Transforms an iterator into a collection. Read more
source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where + E: Extend<Self::Item>, + Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · source§

fn partition<B, F>(self, f: F) -> (B, B)
where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
source§

fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
where + T: 'a, + Self: Sized + DoubleEndedIterator<Item = &'a mut T>, + P: FnMut(&T) -> bool,

🔬This is a nightly-only experimental API. (iter_partition_in_place)
Reorders the elements of this iterator in-place according to the given predicate, +such that all those that return true precede all those that return false. +Returns the number of true elements found. Read more
source§

fn is_partitioned<P>(self, predicate: P) -> bool
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
1.27.0 · source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
1.27.0 · source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
1.0.0 · source§

fn fold<B, F>(self, init: B, f: F) -> B
where + Self: Sized, + F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, +returning the final result. Read more
1.51.0 · source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
source§

fn try_reduce<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> R, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · source§

fn all<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · source§

fn any<F>(&mut self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns +the first non-none result. Read more
source§

fn try_find<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where + Self: Sized, + F: FnMut(&Self::Item) -> R, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
1.0.0 · source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.0.0 · source§

fn rposition<P>(&mut self, predicate: P) -> Option<usize>
where + P: FnMut(Self::Item) -> bool, + Self: Sized + ExactSizeIterator + DoubleEndedIterator,

Searches for an element in an iterator from the right, returning its +index. Read more
1.0.0 · source§

fn max(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the maximum element of an iterator. Read more
1.0.0 · source§

fn min(self) -> Option<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Returns the minimum element of an iterator. Read more
1.6.0 · source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the +specified function. Read more
1.15.0 · source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
1.6.0 · source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the +specified function. Read more
1.15.0 · source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
1.0.0 · source§

fn rev(self) -> Rev<Self>
where + Self: Sized + DoubleEndedIterator,

Reverses an iterator’s direction. Read more
1.0.0 · source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · source§

fn copied<'a, T>(self) -> Copied<Self>
where + T: 'a + Copy, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · source§

fn cloned<'a, T>(self) -> Cloned<Self>
where + T: 'a + Clone, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
1.0.0 · source§

fn cycle(self) -> Cycle<Self>
where + Self: Sized + Clone,

Repeats an iterator endlessly. Read more
source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · source§

fn sum<S>(self) -> S
where + Self: Sized, + S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · source§

fn product<P>(self) -> P
where + Self: Sized, + P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
1.5.0 · source§

fn cmp<I>(self, other: I) -> Ordering
where + I: IntoIterator<Item = Self::Item>, + Self::Item: Ord, + Self: Sized,

Lexicographically compares the elements of this Iterator with those +of another. Read more
source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · source§

fn eq<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are equal to those of +another. Read more
source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
1.5.0 · source§

fn ne<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are not equal to those of +another. Read more
1.5.0 · source§

fn lt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
1.5.0 · source§

fn le<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
1.5.0 · source§

fn gt<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
1.5.0 · source§

fn ge<I>(self, other: I) -> bool
where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
source§

fn is_sorted(self) -> bool
where + Self: Sized, + Self::Item: PartialOrd,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted. Read more
source§

fn is_sorted_by<F>(self, compare: F) -> bool
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> bool,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given comparator function. Read more
source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given key extraction +function. Read more
source§

impl FusedIterator for SquareIter

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

impl<I> IntoIterator for I
where + I: Iterator,

§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
§

type IntoIter = I

Which kind of iterator are we turning this into?
const: unstable · source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
§

impl<T> Itertools for T
where + T: Iterator + ?Sized,

§

fn interleave<J>( + self, + other: J +) -> Interleave<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator<Item = Self::Item>, + Self: Sized,

Alternate elements from two iterators until both have run out. Read more
§

fn interleave_shortest<J>( + self, + other: J +) -> InterleaveShortest<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator<Item = Self::Item>, + Self: Sized,

Alternate elements from two iterators until at least one of them has run +out. Read more
§

fn intersperse( + self, + element: Self::Item +) -> IntersperseWith<Self, IntersperseElementSimple<Self::Item>>
where + Self: Sized, + Self::Item: Clone,

An iterator adaptor to insert a particular value +between each element of the adapted iterator. Read more
§

fn intersperse_with<F>(self, element: F) -> IntersperseWith<Self, F>
where + Self: Sized, + F: FnMut() -> Self::Item,

An iterator adaptor to insert a particular value created by a function +between each element of the adapted iterator. Read more
§

fn zip_longest<J>( + self, + other: J +) -> ZipLongest<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator, + Self: Sized,

Create an iterator which iterates over both this and the specified +iterator simultaneously, yielding pairs of two optional elements. Read more
§

fn zip_eq<J>(self, other: J) -> ZipEq<Self, <J as IntoIterator>::IntoIter>
where + J: IntoIterator, + Self: Sized,

Create an iterator which iterates over both this and the specified +iterator simultaneously, yielding pairs of elements. Read more
§

fn batching<B, F>(self, f: F) -> Batching<Self, F>
where + F: FnMut(&mut Self) -> Option<B>, + Self: Sized,

A “meta iterator adaptor”. Its closure receives a reference to the +iterator and may pick off as many elements as it likes, to produce the +next iterator element. Read more
§

fn group_by<K, F>(self, key: F) -> GroupBy<K, Self, F>
where + Self: Sized, + F: FnMut(&Self::Item) -> K, + K: PartialEq,

Return an iterable that can group iterator elements. +Consecutive elements that map to the same key (“runs”), are assigned +to the same group. Read more
§

fn chunks(self, size: usize) -> IntoChunks<Self>
where + Self: Sized,

Return an iterable that can chunk the iterator. Read more
§

fn tuple_windows<T>(self) -> TupleWindows<Self, T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple, + <T as TupleCollect>::Item: Clone,

Return an iterator over all contiguous windows producing tuples of +a specific size (up to 12). Read more
§

fn circular_tuple_windows<T>(self) -> CircularTupleWindows<Self, T>
where + Self: Sized + Clone + Iterator<Item = <T as TupleCollect>::Item> + ExactSizeIterator, + T: TupleCollect + Clone, + <T as TupleCollect>::Item: Clone,

Return an iterator over all windows, wrapping back to the first +elements when the window would otherwise exceed the length of the +iterator, producing tuples of a specific size (up to 12). Read more
§

fn tuples<T>(self) -> Tuples<Self, T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple,

Return an iterator that groups the items in tuples of a specific size +(up to 12). Read more
§

fn tee(self) -> (Tee<Self>, Tee<Self>)
where + Self: Sized, + Self::Item: Clone,

Split into an iterator pair that both yield all elements from +the original iterator. Read more
§

fn step(self, n: usize) -> Step<Self>
where + Self: Sized,

👎Deprecated since 0.8.0: Use std .step_by() instead
Return an iterator adaptor that steps n elements in the base iterator +for each iteration. Read more
§

fn map_into<R>(self) -> MapSpecialCase<Self, MapSpecialCaseFnInto<R>>
where + Self: Sized, + Self::Item: Into<R>,

Convert each item of the iterator using the Into trait. Read more
§

fn map_results<F, T, U, E>( + self, + f: F +) -> MapSpecialCase<Self, MapSpecialCaseFnOk<F>>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(T) -> U,

👎Deprecated since 0.10.0: Use .map_ok() instead
§

fn map_ok<F, T, U, E>(self, f: F) -> MapSpecialCase<Self, MapSpecialCaseFnOk<F>>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(T) -> U,

Return an iterator adaptor that applies the provided closure +to every Result::Ok value. Result::Err values are +unchanged. Read more
§

fn filter_ok<F, T, E>(self, f: F) -> FilterOk<Self, F>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(&T) -> bool,

Return an iterator adaptor that filters every Result::Ok +value with the provided closure. Result::Err values are +unchanged. Read more
§

fn filter_map_ok<F, T, U, E>(self, f: F) -> FilterMapOk<Self, F>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnMut(T) -> Option<U>,

Return an iterator adaptor that filters and transforms every +Result::Ok value with the provided closure. Result::Err +values are unchanged. Read more
§

fn flatten_ok<T, E>(self) -> FlattenOk<Self, T, E>
where + Self: Sized + Iterator<Item = Result<T, E>>, + T: IntoIterator,

Return an iterator adaptor that flattens every Result::Ok value into +a series of Result::Ok values. Result::Err values are unchanged. Read more
§

fn process_results<F, T, E, R>(self, processor: F) -> Result<R, E>
where + Self: Sized + Iterator<Item = Result<T, E>>, + F: FnOnce(ProcessResults<'_, Self, E>) -> R,

“Lift” a function of the values of the current iterator so as to process +an iterator of Result values instead. Read more
§

fn merge<J>( + self, + other: J +) -> MergeBy<Self, <J as IntoIterator>::IntoIter, MergeLte>
where + Self: Sized, + Self::Item: PartialOrd, + J: IntoIterator<Item = Self::Item>,

Return an iterator adaptor that merges the two base iterators in +ascending order. If both base iterators are sorted (ascending), the +result is sorted. Read more
§

fn merge_by<J, F>( + self, + other: J, + is_first: F +) -> MergeBy<Self, <J as IntoIterator>::IntoIter, F>
where + Self: Sized, + J: IntoIterator<Item = Self::Item>, + F: FnMut(&Self::Item, &Self::Item) -> bool,

Return an iterator adaptor that merges the two base iterators in order. +This is much like .merge() but allows for a custom ordering. Read more
§

fn merge_join_by<J, F, T>( + self, + other: J, + cmp_fn: F +) -> MergeBy<Self, <J as IntoIterator>::IntoIter, MergeFuncLR<F, <F as FuncLR<Self::Item, <<J as IntoIterator>::IntoIter as Iterator>::Item>>::T>>
where + J: IntoIterator, + F: FnMut(&Self::Item, &<J as IntoIterator>::Item) -> T, + Self: Sized,

Create an iterator that merges items from both this and the specified +iterator in ascending order. Read more
§

fn kmerge(self) -> KMergeBy<<Self::Item as IntoIterator>::IntoIter, KMergeByLt>
where + Self: Sized, + Self::Item: IntoIterator, + <Self::Item as IntoIterator>::Item: PartialOrd,

Return an iterator adaptor that flattens an iterator of iterators by +merging them in ascending order. Read more
§

fn kmerge_by<F>( + self, + first: F +) -> KMergeBy<<Self::Item as IntoIterator>::IntoIter, F>
where + Self: Sized, + Self::Item: IntoIterator, + F: FnMut(&<Self::Item as IntoIterator>::Item, &<Self::Item as IntoIterator>::Item) -> bool,

Return an iterator adaptor that flattens an iterator of iterators by +merging them according to the given closure. Read more
§

fn cartesian_product<J>( + self, + other: J +) -> Product<Self, <J as IntoIterator>::IntoIter>
where + Self: Sized, + Self::Item: Clone, + J: IntoIterator, + <J as IntoIterator>::IntoIter: Clone,

Return an iterator adaptor that iterates over the cartesian product of +the element sets of two iterators self and J. Read more
§

fn multi_cartesian_product( + self +) -> MultiProduct<<Self::Item as IntoIterator>::IntoIter>
where + Self: Sized, + Self::Item: IntoIterator, + <Self::Item as IntoIterator>::IntoIter: Clone, + <Self::Item as IntoIterator>::Item: Clone,

Return an iterator adaptor that iterates over the cartesian product of +all subiterators returned by meta-iterator self. Read more
§

fn coalesce<F>(self, f: F) -> CoalesceBy<Self, F, NoCount>
where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Result<Self::Item, (Self::Item, Self::Item)>,

Return an iterator adaptor that uses the passed-in closure to +optionally merge together consecutive elements. Read more
§

fn dedup(self) -> CoalesceBy<Self, DedupPred2CoalescePred<DedupEq>, NoCount>
where + Self: Sized, + Self::Item: PartialEq,

Remove duplicates from sections of consecutive identical elements. +If the iterator is sorted, all elements will be unique. Read more
§

fn dedup_by<Cmp>( + self, + cmp: Cmp +) -> CoalesceBy<Self, DedupPred2CoalescePred<Cmp>, NoCount>
where + Self: Sized, + Cmp: FnMut(&Self::Item, &Self::Item) -> bool,

Remove duplicates from sections of consecutive identical elements, +determining equality using a comparison function. +If the iterator is sorted, all elements will be unique. Read more
§

fn dedup_with_count( + self +) -> CoalesceBy<Self, DedupPredWithCount2CoalescePred<DedupEq>, WithCount>
where + Self: Sized,

Remove duplicates from sections of consecutive identical elements, while keeping a count of +how many repeated elements were present. +If the iterator is sorted, all elements will be unique. Read more
§

fn dedup_by_with_count<Cmp>( + self, + cmp: Cmp +) -> CoalesceBy<Self, DedupPredWithCount2CoalescePred<Cmp>, WithCount>
where + Self: Sized, + Cmp: FnMut(&Self::Item, &Self::Item) -> bool,

Remove duplicates from sections of consecutive identical elements, while keeping a count of +how many repeated elements were present. +This will determine equality using a comparison function. +If the iterator is sorted, all elements will be unique. Read more
§

fn duplicates(self) -> DuplicatesBy<Self, Self::Item, ById>
where + Self: Sized, + Self::Item: Eq + Hash,

Return an iterator adaptor that produces elements that appear more than once during the +iteration. Duplicates are detected using hash and equality. Read more
§

fn duplicates_by<V, F>(self, f: F) -> DuplicatesBy<Self, V, ByFn<F>>
where + Self: Sized, + V: Eq + Hash, + F: FnMut(&Self::Item) -> V,

Return an iterator adaptor that produces elements that appear more than once during the +iteration. Duplicates are detected using hash and equality. Read more
§

fn unique(self) -> Unique<Self>
where + Self: Sized, + Self::Item: Clone + Eq + Hash,

Return an iterator adaptor that filters out elements that have +already been produced once during the iteration. Duplicates +are detected using hash and equality. Read more
§

fn unique_by<V, F>(self, f: F) -> UniqueBy<Self, V, F>
where + Self: Sized, + V: Eq + Hash, + F: FnMut(&Self::Item) -> V,

Return an iterator adaptor that filters out elements that have +already been produced once during the iteration. Read more
§

fn peeking_take_while<F>(&mut self, accept: F) -> PeekingTakeWhile<'_, Self, F>
where + Self: Sized + PeekingNext, + F: FnMut(&Self::Item) -> bool,

Return an iterator adaptor that borrows from this iterator and +takes items while the closure accept returns true. Read more
§

fn take_while_ref<F>(&mut self, accept: F) -> TakeWhileRef<'_, Self, F>
where + Self: Clone, + F: FnMut(&Self::Item) -> bool,

Return an iterator adaptor that borrows from a Clone-able iterator +to only pick off elements while the predicate accept returns true. Read more
§

fn take_while_inclusive<F>(self, accept: F) -> TakeWhileInclusive<Self, F>
where + Self: Sized, + F: FnMut(&Self::Item) -> bool,

Returns an iterator adaptor that consumes elements while the given +predicate is true, including the element for which the predicate +first returned false. Read more
§

fn while_some<A>(self) -> WhileSome<Self>
where + Self: Sized + Iterator<Item = Option<A>>,

Return an iterator adaptor that filters Option<A> iterator elements +and produces A. Stops on the first None encountered. Read more
§

fn tuple_combinations<T>(self) -> TupleCombinations<Self, T>
where + Self: Sized + Clone, + Self::Item: Clone, + T: HasCombination<Self>,

Return an iterator adaptor that iterates over the combinations of the +elements from an iterator. Read more
§

fn combinations(self, k: usize) -> Combinations<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator adaptor that iterates over the k-length combinations of +the elements from an iterator. Read more
§

fn combinations_with_replacement( + self, + k: usize +) -> CombinationsWithReplacement<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator that iterates over the k-length combinations of +the elements from an iterator, with replacement. Read more
§

fn permutations(self, k: usize) -> Permutations<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator adaptor that iterates over all k-permutations of the +elements from an iterator. Read more
§

fn powerset(self) -> Powerset<Self>
where + Self: Sized, + Self::Item: Clone,

Return an iterator that iterates through the powerset of the elements from an +iterator. Read more
§

fn pad_using<F>(self, min: usize, f: F) -> PadUsing<Self, F>
where + Self: Sized, + F: FnMut(usize) -> Self::Item,

Return an iterator adaptor that pads the sequence to a minimum length of +min by filling missing elements using a closure f. Read more
§

fn with_position(self) -> WithPosition<Self>
where + Self: Sized,

Return an iterator adaptor that combines each element with a Position to +ease special-case handling of the first or last elements. Read more
§

fn positions<P>(self, predicate: P) -> Positions<Self, P>
where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Return an iterator adaptor that yields the indices of all elements +satisfying a predicate, counted from the start of the iterator. Read more
§

fn update<F>(self, updater: F) -> Update<Self, F>
where + Self: Sized, + F: FnMut(&mut Self::Item),

Return an iterator adaptor that applies a mutating function +to each element before yielding it. Read more
§

fn next_tuple<T>(&mut self) -> Option<T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple,

Advances the iterator and returns the next items grouped in a tuple of +a specific size (up to 12). Read more
§

fn collect_tuple<T>(self) -> Option<T>
where + Self: Sized + Iterator<Item = <T as TupleCollect>::Item>, + T: HomogeneousTuple,

Collects all items from the iterator into a tuple of a specific size +(up to 12). Read more
§

fn find_position<P>(&mut self, pred: P) -> Option<(usize, Self::Item)>
where + P: FnMut(&Self::Item) -> bool,

Find the position and value of the first element satisfying a predicate. Read more
§

fn find_or_last<P>(self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Find the value of the first element satisfying a predicate or return the last element, if any. Read more
§

fn find_or_first<P>(self, predicate: P) -> Option<Self::Item>
where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Find the value of the first element satisfying a predicate or return the first element, if any. Read more
§

fn contains<Q>(&mut self, query: &Q) -> bool
where + Self: Sized, + Self::Item: Borrow<Q>, + Q: PartialEq,

Returns true if the given item is present in this iterator. Read more
§

fn all_equal(&mut self) -> bool
where + Self: Sized, + Self::Item: PartialEq,

Check whether all elements compare equal. Read more
§

fn all_equal_value( + &mut self +) -> Result<Self::Item, Option<(Self::Item, Self::Item)>>
where + Self: Sized, + Self::Item: PartialEq,

If there are elements and they are all equal, return a single copy of that element. +If there are no elements, return an Error containing None. +If there are elements and they are not all equal, return a tuple containing the first +two non-equal elements found. Read more
§

fn all_unique(&mut self) -> bool
where + Self: Sized, + Self::Item: Eq + Hash,

Check whether all elements are unique (non equal). Read more
§

fn dropping(self, n: usize) -> Self
where + Self: Sized,

Consume the first n elements from the iterator eagerly, +and return the same iterator again. Read more
§

fn dropping_back(self, n: usize) -> Self
where + Self: Sized + DoubleEndedIterator,

Consume the last n elements from the iterator eagerly, +and return the same iterator again. Read more
§

fn foreach<F>(self, f: F)
where + F: FnMut(Self::Item), + Self: Sized,

👎Deprecated since 0.8.0: Use .for_each() instead
Run the closure f eagerly on each element of the iterator. Read more
§

fn concat(self) -> Self::Item
where + Self: Sized, + Self::Item: Extend<<Self::Item as IntoIterator>::Item> + IntoIterator + Default,

Combine all an iterator’s elements into one element by using Extend. Read more
§

fn collect_vec(self) -> Vec<Self::Item>
where + Self: Sized,

.collect_vec() is simply a type specialization of Iterator::collect, +for convenience.
§

fn try_collect<T, U, E>(self) -> Result<U, E>
where + Self: Sized + Iterator<Item = Result<T, E>>, + Result<U, E>: FromIterator<Result<T, E>>,

.try_collect() is more convenient way of writing +.collect::<Result<_, _>>() Read more
§

fn set_from<'a, A, J>(&mut self, from: J) -> usize
where + A: 'a, + Self: Iterator<Item = &'a mut A>, + J: IntoIterator<Item = A>,

Assign to each reference in self from the from iterator, +stopping at the shortest of the two iterators. Read more
§

fn join(&mut self, sep: &str) -> String
where + Self::Item: Display,

Combine all iterator elements into one String, separated by sep. Read more
§

fn format(self, sep: &str) -> Format<'_, Self>
where + Self: Sized,

Format all iterator elements, separated by sep. Read more
§

fn format_with<F>(self, sep: &str, format: F) -> FormatWith<'_, Self, F>
where + Self: Sized, + F: FnMut(Self::Item, &mut dyn FnMut(&dyn Display) -> Result<(), Error>) -> Result<(), Error>,

Format all iterator elements, separated by sep. Read more
§

fn fold_results<A, E, B, F>(&mut self, start: B, f: F) -> Result<B, E>
where + Self: Iterator<Item = Result<A, E>>, + F: FnMut(B, A) -> B,

👎Deprecated since 0.10.0: Use .fold_ok() instead
§

fn fold_ok<A, E, B, F>(&mut self, start: B, f: F) -> Result<B, E>
where + Self: Iterator<Item = Result<A, E>>, + F: FnMut(B, A) -> B,

Fold Result values from an iterator. Read more
§

fn fold_options<A, B, F>(&mut self, start: B, f: F) -> Option<B>
where + Self: Iterator<Item = Option<A>>, + F: FnMut(B, A) -> B,

Fold Option values from an iterator. Read more
§

fn fold1<F>(self, f: F) -> Option<Self::Item>
where + F: FnMut(Self::Item, Self::Item) -> Self::Item, + Self: Sized,

👎Deprecated since 0.10.2: Use Iterator::reduce instead
Accumulator of the elements in the iterator. Read more
§

fn tree_fold1<F>(self, f: F) -> Option<Self::Item>
where + F: FnMut(Self::Item, Self::Item) -> Self::Item, + Self: Sized,

Accumulate the elements in the iterator in a tree-like manner. Read more
§

fn fold_while<B, F>(&mut self, init: B, f: F) -> FoldWhile<B>
where + Self: Sized, + F: FnMut(B, Self::Item) -> FoldWhile<B>,

An iterator method that applies a function, producing a single, final value. Read more
§

fn sum1<S>(self) -> Option<S>
where + Self: Sized, + S: Sum<Self::Item>,

Iterate over the entire iterator and add all the elements. Read more
§

fn product1<P>(self) -> Option<P>
where + Self: Sized, + P: Product<Self::Item>,

Iterate over the entire iterator and multiply all the elements. Read more
§

fn sorted_unstable(self) -> IntoIter<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_unstable_by<F>(self, cmp: F) -> IntoIter<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_unstable_by_key<K, F>(self, f: F) -> IntoIter<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted(self) -> IntoIter<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_by<F>(self, cmp: F) -> IntoIter<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_by_key<K, F>(self, f: F) -> IntoIter<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Sort all iterator elements into a new iterator in ascending order. Read more
§

fn sorted_by_cached_key<K, F>(self, f: F) -> IntoIter<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Sort all iterator elements into a new iterator in ascending order. The key function is +called exactly once per key. Read more
§

fn k_smallest(self, k: usize) -> IntoIter<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Sort the k smallest elements into a new iterator, in ascending order. Read more
§

fn partition_map<A, B, F, L, R>(self, predicate: F) -> (A, B)
where + Self: Sized, + F: FnMut(Self::Item) -> Either<L, R>, + A: Default + Extend<L>, + B: Default + Extend<R>,

Collect all iterator elements into one of two +partitions. Unlike Iterator::partition, each partition may +have a distinct type. Read more
§

fn partition_result<A, B, T, E>(self) -> (A, B)
where + Self: Sized + Iterator<Item = Result<T, E>>, + A: Default + Extend<T>, + B: Default + Extend<E>,

Partition a sequence of Results into one list of all the Ok elements +and another list of all the Err elements. Read more
§

fn into_group_map<K, V>(self) -> HashMap<K, Vec<V>>
where + Self: Sized + Iterator<Item = (K, V)>, + K: Hash + Eq,

Return a HashMap of keys mapped to Vecs of values. Keys and values +are taken from (Key, Value) tuple pairs yielded by the input iterator. Read more
§

fn into_group_map_by<K, V, F>(self, f: F) -> HashMap<K, Vec<V>>
where + Self: Sized + Iterator<Item = V>, + K: Hash + Eq, + F: Fn(&V) -> K,

Return an Iterator on a HashMap. Keys mapped to Vecs of values. The key is specified +in the closure. Read more
§

fn into_grouping_map<K, V>(self) -> GroupingMap<Self>
where + Self: Sized + Iterator<Item = (K, V)>, + K: Hash + Eq,

Constructs a GroupingMap to be used later with one of the efficient +group-and-fold operations it allows to perform. Read more
§

fn into_grouping_map_by<K, V, F>( + self, + key_mapper: F +) -> GroupingMap<MapForGrouping<Self, F>>
where + Self: Sized + Iterator<Item = V>, + K: Hash + Eq, + F: FnMut(&V) -> K,

Constructs a GroupingMap to be used later with one of the efficient +group-and-fold operations it allows to perform. Read more
§

fn min_set(self) -> Vec<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Return all minimum elements of an iterator. Read more
§

fn min_set_by<F>(self, compare: F) -> Vec<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return all minimum elements of an iterator, as determined by +the specified function. Read more
§

fn min_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return all minimum elements of an iterator, as determined by +the specified function. Read more
§

fn max_set(self) -> Vec<Self::Item>
where + Self: Sized, + Self::Item: Ord,

Return all maximum elements of an iterator. Read more
§

fn max_set_by<F>(self, compare: F) -> Vec<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return all maximum elements of an iterator, as determined by +the specified function. Read more
§

fn max_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return all maximum elements of an iterator, as determined by +the specified function. Read more
§

fn minmax(self) -> MinMaxResult<Self::Item>
where + Self: Sized, + Self::Item: PartialOrd,

Return the minimum and maximum elements in the iterator. Read more
§

fn minmax_by_key<K, F>(self, key: F) -> MinMaxResult<Self::Item>
where + Self: Sized, + K: PartialOrd, + F: FnMut(&Self::Item) -> K,

Return the minimum and maximum element of an iterator, as determined by +the specified function. Read more
§

fn minmax_by<F>(self, compare: F) -> MinMaxResult<Self::Item>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the minimum and maximum element of an iterator, as determined by +the specified comparison function. Read more
§

fn position_max(self) -> Option<usize>
where + Self: Sized, + Self::Item: Ord,

Return the position of the maximum element in the iterator. Read more
§

fn position_max_by_key<K, F>(self, key: F) -> Option<usize>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return the position of the maximum element in the iterator, as +determined by the specified function. Read more
§

fn position_max_by<F>(self, compare: F) -> Option<usize>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the position of the maximum element in the iterator, as +determined by the specified comparison function. Read more
§

fn position_min(self) -> Option<usize>
where + Self: Sized, + Self::Item: Ord,

Return the position of the minimum element in the iterator. Read more
§

fn position_min_by_key<K, F>(self, key: F) -> Option<usize>
where + Self: Sized, + K: Ord, + F: FnMut(&Self::Item) -> K,

Return the position of the minimum element in the iterator, as +determined by the specified function. Read more
§

fn position_min_by<F>(self, compare: F) -> Option<usize>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the position of the minimum element in the iterator, as +determined by the specified comparison function. Read more
§

fn position_minmax(self) -> MinMaxResult<usize>
where + Self: Sized, + Self::Item: PartialOrd,

Return the positions of the minimum and maximum elements in +the iterator. Read more
§

fn position_minmax_by_key<K, F>(self, key: F) -> MinMaxResult<usize>
where + Self: Sized, + K: PartialOrd, + F: FnMut(&Self::Item) -> K,

Return the postions of the minimum and maximum elements of an +iterator, as determined by the specified function. Read more
§

fn position_minmax_by<F>(self, compare: F) -> MinMaxResult<usize>
where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Return the postions of the minimum and maximum elements of an +iterator, as determined by the specified comparison function. Read more
§

fn exactly_one(self) -> Result<Self::Item, ExactlyOneError<Self>>
where + Self: Sized,

If the iterator yields exactly one element, that element will be returned, otherwise +an error will be returned containing an iterator that has the same output as the input +iterator. Read more
§

fn at_most_one(self) -> Result<Option<Self::Item>, ExactlyOneError<Self>>
where + Self: Sized,

If the iterator yields no elements, Ok(None) will be returned. If the iterator yields +exactly one element, that element will be returned, otherwise an error will be returned +containing an iterator that has the same output as the input iterator. Read more
§

fn multipeek(self) -> MultiPeek<Self>
where + Self: Sized,

An iterator adaptor that allows the user to peek at multiple .next() +values without advancing the base iterator. Read more
§

fn counts(self) -> HashMap<Self::Item, usize>
where + Self: Sized, + Self::Item: Eq + Hash,

Collect the items in this iterator and return a HashMap which +contains each item that appears in the iterator and the number +of times it appears. Read more
§

fn counts_by<K, F>(self, f: F) -> HashMap<K, usize>
where + Self: Sized, + K: Eq + Hash, + F: FnMut(Self::Item) -> K,

Collect the items in this iterator and return a HashMap which +contains each item that appears in the iterator and the number +of times it appears, +determining identity using a keying function. Read more
§

fn multiunzip<FromI>(self) -> FromI
where + Self: Sized + MultiUnzip<FromI>,

Converts an iterator of tuples into a tuple of containers. Read more
§

fn try_len(&self) -> Result<usize, (usize, Option<usize>)>

Returns the length of the iterator if one exists. +Otherwise return self.size_hint(). Read more
§

impl<T> ParallelBridge for T
where + T: Iterator + Send, + <T as Iterator>::Item: Send,

§

fn par_bridge(self) -> IterBridge<T>

Creates a bridge from this type to a ParallelIterator.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/core/type.MoveList.html b/docs/pabi/chess/core/type.MoveList.html new file mode 100644 index 00000000..fe56f465 --- /dev/null +++ b/docs/pabi/chess/core/type.MoveList.html @@ -0,0 +1,8 @@ +MoveList in pabi::chess::core - Rust +

Type Alias pabi::chess::core::MoveList

source ·
pub type MoveList = ArrayVec<Move, { MAX_MOVES }>;
Expand description

Moves are stored on stack to avoid memory allocations. This is important for +performance reasons and also prevents unnecessary copying that would occur +if the moves would be stored in std::Vec with unknown capacity.

+

Aliased Type§

struct MoveList {
+    xs: [MaybeUninit<Move>; 256],
+    len: u32,
+}

Fields§

§xs: [MaybeUninit<Move>; 256]§len: u32
\ No newline at end of file diff --git a/docs/pabi/chess/index.html b/docs/pabi/chess/index.html new file mode 100644 index 00000000..b5f8c407 --- /dev/null +++ b/docs/pabi/chess/index.html @@ -0,0 +1,16 @@ +pabi::chess - Rust +

Module pabi::chess

source ·
Expand description

Implementation of chess environment, its rules and specifics.

+

Modules§

  • Mappings of occupied squares to the attacked squares for each piece. The +mappings are pre-calculated where possible to provide an efficient way of +generating moves.
  • Bitboard-based representation for crate::chess::position::Position. +Bitboards utilize the fact that modern processors operate on 64 bit +integers, and the bit operations can be performed simultaneously. This +results in very efficient calculation of possible attack vectors and other +meaningful features that are required to calculate possible moves and +evaluate position. The disadvantage is complexity that comes with bitboard +implementation and inefficiency of some operations like “get piece type on +given square” (efficiently handled by Square-centric board implementations +that can be used together bitboard-based approach to compensate its +shortcomings).
  • Chess primitives commonly used within crate::chess.
  • Provides fully-specified Chess Position implementation: stores +information about the board and tracks the state of castling, 50-move rule +draw, etc.
\ No newline at end of file diff --git a/docs/pabi/chess/position/fn.generate_bishop_moves.html b/docs/pabi/chess/position/fn.generate_bishop_moves.html new file mode 100644 index 00000000..56003f61 --- /dev/null +++ b/docs/pabi/chess/position/fn.generate_bishop_moves.html @@ -0,0 +1,10 @@ +generate_bishop_moves in pabi::chess::position - Rust +
fn generate_bishop_moves(
+    bishops: Bitboard,
+    occupied_squares: Bitboard,
+    their_or_empty: Bitboard,
+    blocking_ray: Bitboard,
+    pins: Bitboard,
+    king: Square,
+    moves: &mut MoveList
+)
\ No newline at end of file diff --git a/docs/pabi/chess/position/fn.generate_castle_moves.html b/docs/pabi/chess/position/fn.generate_castle_moves.html new file mode 100644 index 00000000..b1c956df --- /dev/null +++ b/docs/pabi/chess/position/fn.generate_castle_moves.html @@ -0,0 +1,9 @@ +generate_castle_moves in pabi::chess::position - Rust +
fn generate_castle_moves(
+    us: Player,
+    checkers: Bitboard,
+    castling: CastleRights,
+    attacks: Bitboard,
+    occupied_squares: Bitboard,
+    moves: &mut MoveList
+)
\ No newline at end of file diff --git a/docs/pabi/chess/position/fn.generate_king_moves.html b/docs/pabi/chess/position/fn.generate_king_moves.html new file mode 100644 index 00000000..52ab4b66 --- /dev/null +++ b/docs/pabi/chess/position/fn.generate_king_moves.html @@ -0,0 +1,6 @@ +generate_king_moves in pabi::chess::position - Rust +
fn generate_king_moves(
+    king: Square,
+    safe_squares: Bitboard,
+    moves: &mut MoveList
+)
\ No newline at end of file diff --git a/docs/pabi/chess/position/fn.generate_knight_moves.html b/docs/pabi/chess/position/fn.generate_knight_moves.html new file mode 100644 index 00000000..c640a776 --- /dev/null +++ b/docs/pabi/chess/position/fn.generate_knight_moves.html @@ -0,0 +1,8 @@ +generate_knight_moves in pabi::chess::position - Rust +
fn generate_knight_moves(
+    knights: Bitboard,
+    their_or_empty: Bitboard,
+    pins: Bitboard,
+    blocking_ray: Bitboard,
+    moves: &mut MoveList
+)
\ No newline at end of file diff --git a/docs/pabi/chess/position/fn.generate_pawn_moves.html b/docs/pabi/chess/position/fn.generate_pawn_moves.html new file mode 100644 index 00000000..afca8684 --- /dev/null +++ b/docs/pabi/chess/position/fn.generate_pawn_moves.html @@ -0,0 +1,16 @@ +generate_pawn_moves in pabi::chess::position - Rust +
fn generate_pawn_moves(
+    pawns: Bitboard,
+    us: Player,
+    they: Player,
+    their_pieces: &Pieces,
+    their_occupancy: Bitboard,
+    their_or_empty: Bitboard,
+    blocking_ray: Bitboard,
+    pins: Bitboard,
+    checkers: Bitboard,
+    king: Square,
+    en_passant_square: Option<Square>,
+    occupied_squares: Bitboard,
+    moves: &mut MoveList
+)
\ No newline at end of file diff --git a/docs/pabi/chess/position/fn.generate_rook_moves.html b/docs/pabi/chess/position/fn.generate_rook_moves.html new file mode 100644 index 00000000..5b616ca8 --- /dev/null +++ b/docs/pabi/chess/position/fn.generate_rook_moves.html @@ -0,0 +1,10 @@ +generate_rook_moves in pabi::chess::position - Rust +
fn generate_rook_moves(
+    rooks: Bitboard,
+    occupied_squares: Bitboard,
+    their_or_empty: Bitboard,
+    blocking_ray: Bitboard,
+    pins: Bitboard,
+    king: Square,
+    moves: &mut MoveList
+)
\ No newline at end of file diff --git a/docs/pabi/chess/position/fn.perft.html b/docs/pabi/chess/position/fn.perft.html new file mode 100644 index 00000000..8211f0a6 --- /dev/null +++ b/docs/pabi/chess/position/fn.perft.html @@ -0,0 +1,5 @@ +perft in pabi::chess::position - Rust +

Function pabi::chess::position::perft

source ·
pub fn perft(position: &Position, depth: u8) -> u64
Expand description

Perft (performance testing) is a technique for checking +correctness of move generation by traversing the tree of possible positions +(nodes) and calculating all the leaf nodes at certain depth.

+
\ No newline at end of file diff --git a/docs/pabi/chess/position/fn.validate.html b/docs/pabi/chess/position/fn.validate.html new file mode 100644 index 00000000..a3a0af7c --- /dev/null +++ b/docs/pabi/chess/position/fn.validate.html @@ -0,0 +1,2 @@ +validate in pabi::chess::position - Rust +

Function pabi::chess::position::validate

source ·
fn validate(position: &Position) -> Result<()>
\ No newline at end of file diff --git a/docs/pabi/chess/position/index.html b/docs/pabi/chess/position/index.html new file mode 100644 index 00000000..4d762282 --- /dev/null +++ b/docs/pabi/chess/position/index.html @@ -0,0 +1,10 @@ +pabi::chess::position - Rust +

Module pabi::chess::position

source ·
Expand description

Provides fully-specified Chess Position implementation: stores +information about the board and tracks the state of castling, 50-move rule +draw, etc.

+

The core of Move Generator and move making is also implemented here as a way +to produce ways of mutating Position.

+

Structs§

Functions§

\ No newline at end of file diff --git a/docs/pabi/chess/position/sidebar-items.js b/docs/pabi/chess/position/sidebar-items.js new file mode 100644 index 00000000..ff58caba --- /dev/null +++ b/docs/pabi/chess/position/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["generate_bishop_moves","generate_castle_moves","generate_king_moves","generate_knight_moves","generate_pawn_moves","generate_rook_moves","perft","validate"],"struct":["Position"]}; \ No newline at end of file diff --git a/docs/pabi/chess/position/struct.Position.html b/docs/pabi/chess/position/struct.Position.html new file mode 100644 index 00000000..4e5076d1 --- /dev/null +++ b/docs/pabi/chess/position/struct.Position.html @@ -0,0 +1,90 @@ +Position in pabi::chess::position - Rust +

Struct pabi::chess::position::Position

source ·
pub struct Position {
+    board: Board,
+    castling: CastleRights,
+    side_to_move: Player,
+    halfmove_clock: u8,
+    fullmove_counter: u16,
+    en_passant_square: Option<Square>,
+}
Expand description

State of the chess game: board, half-move counters and castling rights, +etc. It has 1:1 relationship with Forsyth-Edwards Notation (FEN).

+

Position::try_from() provides a convenient interface for creating a +Position. It will clean up the input (trim newlines and whitespace) and +attempt to parse in either FEN or a version of Extended Position +Description (EPD). The EPD format Pabi accepts does not support +Operations: even though it is an important part of EPD, in practice it is +rarely needed. The EPD support exists for compatibility with some databases +which provide trimmed FEN lines (all FEN parts except Halfmove Clock and +Fullmove Counter). Parsing these positions is important to utilize that +data.

+

Fields§

§board: Board§castling: CastleRights§side_to_move: Player§halfmove_clock: u8

Halfmove Clock1 keeps track of the number of (half-)moves +since the last capture or pawn move and is used to enforce +fifty2-move draw rule.

+

  1. “Half-move” or “ply” means a move of only +one side. + 

  2. 50 full moves 

§fullmove_counter: u16§en_passant_square: Option<Square>

Implementations§

source§

impl Position

source

pub fn starting() -> Self

Creates the starting position of the standard chess.

+ +
use pabi::chess::position::Position;
+
+let starting_position = Position::starting();
+assert_eq!(
+    &starting_position.to_string(),
+    "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
+);
+
source

fn empty() -> Self

source

pub(super) fn us(&self) -> Player

source

pub(super) fn they(&self) -> Player

source

pub(super) fn pieces(&self, player: Player) -> &Pieces

source

fn occupancy(&self, player: Player) -> Bitboard

source

fn occupied_squares(&self) -> Bitboard

source

pub fn from_fen(input: &str) -> Result<Self>

Parses board from Forsyth-Edwards Notation and checks its correctness. +The parser will accept trimmed full FEN and trimmed FEN (4 first parts).

+

FEN ::= +Piece Placement +’ ’ Side to move +’ ’ Castling ability +’ ’ En passant target square +’ ’ Halfmove clock +’ ’ Fullmove counter

+

The last two parts (together) are optional and will default to “0 1”. +Technically, that is not a full FEN position, but it is supported +because EPD-style position strings are common in public position books +and datasets where halfmove clock and fullmove counters do not matter. +Supporting these datasets is important but distinguishing between full +and trimmed FEN strings is not.

+

Correctness check employs a small set of simple heuristics to check if +the position can be analyzed by the engine and will reject the most +obvious incorrect positions (e.g. missing kings, pawns on the wrong +ranks, problems with en passant square). The only public way of creating +a Position is by parsing it from string, so this acts as a filter +for positions that won’t cause undefined behavior or crashes. It’s +important that positions that are known to be dubious are filtered out.

+

NOTE: This expects properly-formatted inputs: no extra symbols or +additional whitespace. Use Position::try_from for cleaning up the +input if it is coming from untrusted source and is likely to contain +extra symbols.

+
source

pub fn fen(&self) -> String

Returns a string representation of the position in FEN format.

+
source

pub fn has_insufficient_material(&self) -> bool

source

pub(super) fn attack_info(&self) -> AttackInfo

source

pub fn generate_moves(&self) -> MoveList

Calculates a list of legal moves (i.e. the moves that do not leave our +king in check).

+

This is a performance and correctness-critical path: every modification +should be benchmarked and carefully tested.

+

NOTE: BMI Instruction Set (and specifically efficient PEXT) is not +widely available on all processors (e.g. the AMD only started providing +an efficient PEXT since Ryzen 3). The current implementation will +rely on PEXT for performance because it is the most efficient move +generator technique available.

+
source

pub fn make_move(&mut self, next_move: &Move)

Trait Implementations§

source§

impl Clone for Position

source§

fn clone(&self) -> Position

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Position

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Position

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Prints board in Forsyth-Edwards Notation.

+
source§

impl TryFrom<&str> for Position

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(input: &str) -> Result<Self>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for T
where + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> +if into_left is true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where + F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> +if into_left(&self) returns true. +Converts self into a Right variant of Either<Self, Self> +otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where + T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where + U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/docs/pabi/chess/sidebar-items.js b/docs/pabi/chess/sidebar-items.js new file mode 100644 index 00000000..70d1e168 --- /dev/null +++ b/docs/pabi/chess/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"mod":["attacks","bitboard","core","position"]}; \ No newline at end of file diff --git a/docs/pabi/constant.VERSION.html b/docs/pabi/constant.VERSION.html new file mode 100644 index 00000000..0ddf137f --- /dev/null +++ b/docs/pabi/constant.VERSION.html @@ -0,0 +1,2 @@ +VERSION in pabi - Rust +

Constant pabi::VERSION

source ·
pub const VERSION: &str = "0.0.0 (8df5834002b5cf28895ab3c4e24c969b219595c2)\nBuild type: debug\nTarget: x86_64-unknown-linux-gnu";
\ No newline at end of file diff --git a/docs/pabi/evaluation/evaluator/index.html b/docs/pabi/evaluation/evaluator/index.html new file mode 100644 index 00000000..a7a33fe6 --- /dev/null +++ b/docs/pabi/evaluation/evaluator/index.html @@ -0,0 +1,2 @@ +pabi::evaluation::evaluator - Rust +

Module pabi::evaluation::evaluator

source ·

Traits§

\ No newline at end of file diff --git a/docs/pabi/evaluation/evaluator/sidebar-items.js b/docs/pabi/evaluation/evaluator/sidebar-items.js new file mode 100644 index 00000000..ce91eb1f --- /dev/null +++ b/docs/pabi/evaluation/evaluator/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"trait":["Evaluator"]}; \ No newline at end of file diff --git a/docs/pabi/evaluation/evaluator/trait.Evaluator.html b/docs/pabi/evaluation/evaluator/trait.Evaluator.html new file mode 100644 index 00000000..35f63ae9 --- /dev/null +++ b/docs/pabi/evaluation/evaluator/trait.Evaluator.html @@ -0,0 +1,2 @@ +Evaluator in pabi::evaluation::evaluator - Rust +
pub trait Evaluator { }

Implementors§

\ No newline at end of file diff --git a/docs/pabi/evaluation/index.html b/docs/pabi/evaluation/index.html new file mode 100644 index 00000000..31cc46cf --- /dev/null +++ b/docs/pabi/evaluation/index.html @@ -0,0 +1,2 @@ +pabi::evaluation - Rust +

Module pabi::evaluation

source ·

Modules§

\ No newline at end of file diff --git a/docs/pabi/evaluation/sidebar-items.js b/docs/pabi/evaluation/sidebar-items.js new file mode 100644 index 00000000..74321eb1 --- /dev/null +++ b/docs/pabi/evaluation/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"mod":["evaluator"]}; \ No newline at end of file diff --git a/docs/pabi/fn.print_system_info.html b/docs/pabi/fn.print_system_info.html new file mode 100644 index 00000000..e9d2f956 --- /dev/null +++ b/docs/pabi/fn.print_system_info.html @@ -0,0 +1,3 @@ +print_system_info in pabi - Rust +

Function pabi::print_system_info

source ·
pub fn print_system_info()
Expand description

Prints information about the host system.

+
\ No newline at end of file diff --git a/docs/pabi/index.html b/docs/pabi/index.html new file mode 100644 index 00000000..05e8f6c5 --- /dev/null +++ b/docs/pabi/index.html @@ -0,0 +1,10 @@ +pabi - Rust +

Crate pabi

source ·
Expand description

Modern and high-quality chess engine. For more information, see

+
    +
  • README explaining about design and implementation goals
  • +
  • Resources for information on important papers, other engines and +prominent research ideas
  • +
+

Modules§

  • Implementation of chess environment, its rules and specifics.
  • Interface between the engine and the front-end (tournament runner or GUI).
  • Convenient utility functions for Pabi that can be used from benchmarks and +public tests.

Constants§

Functions§

\ No newline at end of file diff --git a/docs/pabi/interface/index.html b/docs/pabi/interface/index.html new file mode 100644 index 00000000..53287c48 --- /dev/null +++ b/docs/pabi/interface/index.html @@ -0,0 +1,3 @@ +pabi::interface - Rust +

Module pabi::interface

source ·
Expand description

Interface between the engine and the front-end (tournament runner or GUI).

+

Modules§

\ No newline at end of file diff --git a/docs/pabi/interface/sidebar-items.js b/docs/pabi/interface/sidebar-items.js new file mode 100644 index 00000000..c4fae4a2 --- /dev/null +++ b/docs/pabi/interface/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"mod":["uci"]}; \ No newline at end of file diff --git a/docs/pabi/interface/uci/fn.run.html b/docs/pabi/interface/uci/fn.run.html new file mode 100644 index 00000000..700a0c52 --- /dev/null +++ b/docs/pabi/interface/uci/fn.run.html @@ -0,0 +1,2 @@ +run in pabi::interface::uci - Rust +

Function pabi::interface::uci::run

source ·
fn run()
\ No newline at end of file diff --git a/docs/pabi/interface/uci/index.html b/docs/pabi/interface/uci/index.html new file mode 100644 index 00000000..d58e8936 --- /dev/null +++ b/docs/pabi/interface/uci/index.html @@ -0,0 +1,2 @@ +pabi::interface::uci - Rust +

Module pabi::interface::uci

source ·

Functions§

\ No newline at end of file diff --git a/docs/pabi/interface/uci/sidebar-items.js b/docs/pabi/interface/uci/sidebar-items.js new file mode 100644 index 00000000..b5159ecb --- /dev/null +++ b/docs/pabi/interface/uci/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["run"]}; \ No newline at end of file diff --git a/docs/pabi/sidebar-items.js b/docs/pabi/sidebar-items.js new file mode 100644 index 00000000..65421528 --- /dev/null +++ b/docs/pabi/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["VERSION"],"fn":["print_system_info"],"mod":["chess","evaluation","interface","util"]}; \ No newline at end of file diff --git a/docs/pabi/util/fn.sanitize_fen.html b/docs/pabi/util/fn.sanitize_fen.html new file mode 100644 index 00000000..60dcf1ec --- /dev/null +++ b/docs/pabi/util/fn.sanitize_fen.html @@ -0,0 +1,2 @@ +sanitize_fen in pabi::util - Rust +

Function pabi::util::sanitize_fen

source ·
pub fn sanitize_fen(position: &str) -> String
\ No newline at end of file diff --git a/docs/pabi/util/index.html b/docs/pabi/util/index.html new file mode 100644 index 00000000..e273e07d --- /dev/null +++ b/docs/pabi/util/index.html @@ -0,0 +1,4 @@ +pabi::util - Rust +

Module pabi::util

source ·
Expand description

Convenient utility functions for Pabi that can be used from benchmarks and +public tests.

+

Functions§

\ No newline at end of file diff --git a/docs/pabi/util/sidebar-items.js b/docs/pabi/util/sidebar-items.js new file mode 100644 index 00000000..0354c5fa --- /dev/null +++ b/docs/pabi/util/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["sanitize_fen"]}; \ No newline at end of file diff --git a/docs/search-index.js b/docs/search-index.js new file mode 100644 index 00000000..706c9f82 --- /dev/null +++ b/docs/search-index.js @@ -0,0 +1,5 @@ +var searchIndex = new Map(JSON.parse('[\ +["pabi",{"doc":"Modern and high-quality chess engine. For more …","t":"SCCCHCCCCCFSSSSSSSSSSSSSSSSSSSSSSSOHHNNONNNNNNNHHNHHOHHHHONNNOFFFSFSNNNNONNNNNNOONONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOONNNNNNONOONNNNNNNNNNNNNNNNNNNNNNNOPPPPPPPPPTPPPPPPPPPTTTSSPPPPPPPPPPPPFPPPPPPPPPGFPPPPPPPPPPPPPPPPPPPPGFPPPPPPPPPPPPPPPPPPPPPPPSFITPPFGGGPPGFPPPPGFPPPTTTPNOOOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNNNNNNNNNOOOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNONNNNOOOOONNNNNNNNNNNNNNNNNNNNONNNNNNNNNNONNNNNNNNNNNNONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNOFNONNONNNNNNONNNNNOHHHHNHHONNNNNNNHNONNNNNNNNNHCKCHH","n":["VERSION","chess","evaluation","interface","print_system_info","util","attacks","bitboard","core","position","AttackInfo","BISHOP_ATTACKS","BISHOP_ATTACKS_COUNT","BISHOP_ATTACK_OFFSETS","BISHOP_RAYS","BISHOP_RELEVANT_OCCUPANCIES","BLACK_LONG_CASTLE_KING_WALK","BLACK_LONG_CASTLE_ROOK_WALK","BLACK_PAWN_ATTACKS","BLACK_SHORT_CASTLE_KING_WALK","BLACK_SHORT_CASTLE_ROOK_WALK","KING_ATTACKS","KNIGHT_ATTACKS","RAYS","ROOK_ATTACKS","ROOK_ATTACKS_COUNT","ROOK_ATTACK_OFFSETS","ROOK_RAYS","ROOK_RELEVANT_OCCUPANCIES","WHITE_LONG_CASTLE_KING_WALK","WHITE_LONG_CASTLE_ROOK_WALK","WHITE_PAWN_ATTACKS","WHITE_SHORT_CASTLE_KING_WALK","WHITE_SHORT_CASTLE_ROOK_WALK","attacks","bishop_attacks","bishop_ray","borrow","borrow_mut","checkers","deref","deref_mut","drop","fmt","from","init","into","king_attacks","knight_attacks","new","pawn_attacks","pext","pins","queen_attacks","ray","rook_attacks","rook_ray","safe_king_squares","try_from","try_into","type_id","xrays","Bitboard","BitboardIterator","Board","LINE_SEPARATOR","Pieces","SQUARE_SEPARATOR","all","as_square","at","at","bishops","bitand","bitand_assign","bitboard_for","bitor","bitor_assign","bits","bits","bits","bitxor","black_pieces","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clear","clear","clone","clone","clone","clone_into","clone_into","clone_into","contains","count","deref","deref","deref","deref","deref_mut","deref_mut","deref_mut","deref_mut","drop","drop","drop","drop","empty","empty","empty","eq","eq","eq","extend","fmt","fmt","fmt","from","from","from","from","from","from_bits","from_squares","full","has_any","init","init","init","init","into","into","into","into","into_iter","is_empty","iter","king","knights","len","new_black","new_white","next","not","par_bridge","pawns","player_pieces","queens","rooks","shift","shl","shr","starting","sub","sub_assign","to_owned","to_owned","to_owned","to_string","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","white_pieces","A","A1","A2","A3","A4","A5","A6","A7","A8","ALL","B","B1","B2","B3","B4","B5","B6","B7","B8","BLACK_BOTH","BLACK_LONG","BLACK_SHORT","BOARD_SIZE","BOARD_WIDTH","Bishop","Bishop","Black","C","C1","C2","C3","C4","C5","C6","C7","C8","CastleRights","D","D1","D2","D3","D4","D5","D6","D7","D8","Direction","DirectionIter","Down","E","E1","E2","E3","E4","E5","E6","E7","E8","Eight","F","F1","F2","F3","F4","F5","F6","F7","F8","File","FileIter","Five","Four","G","G1","G2","G3","G4","G5","G6","G7","G8","H","H1","H2","H3","H4","H5","H6","H7","H8","King","Knight","Knight","MAX_MOVES","Move","MoveList","NONE","One","Pawn","Piece","PieceKind","Player","Promotion","Queen","Queen","Rank","RankIter","Rook","Rook","Seven","Six","Square","SquareIter","Three","Two","Up","WHITE_BOTH","WHITE_LONG","WHITE_SHORT","White","all","back_idx","back_idx","back_idx","back_idx","backrank","bitand","bitand_assign","bitor","bitor_assign","bits","bits","bitxor","bitxor_assign","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","cmp","cmp","cmp","complement","contains","deref","deref","deref","deref","deref","deref","deref","deref","deref","deref","deref","deref","deref","deref","deref_mut","deref_mut","deref_mut","deref_mut","deref_mut","deref_mut","deref_mut","deref_mut","deref_mut","deref_mut","deref_mut","deref_mut","deref_mut","deref_mut","difference","drop","drop","drop","drop","drop","drop","drop","drop","drop","drop","drop","drop","drop","drop","empty","eq","eq","eq","eq","eq","eq","eq","extend","file","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from_bits","from_bits_retain","from_bits_retain","from_bits_truncate","from_iter","from_name","from_san","get","get","get","get","hash","idx","idx","idx","idx","init","init","init","init","init","init","init","init","init","init","init","init","init","init","insert","intersection","intersects","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into_iter","into_iter","into_iter","into_iter","into_iter","is_all","is_empty","iter","iter","iter","iter","iter","iter_names","kind","len","len","len","len","len","marker","marker","marker","marker","mask","mask","mask","new","new","next","next","next","next","next_back","next_back","next_back","next_back","not","nth","nth","nth","nth","opponent","opposite","owner","par_bridge","par_bridge","par_bridge","par_bridge","partial_cmp","partial_cmp","partial_cmp","partial_cmp","partial_cmp","pawns_starting","promotion","push_direction","rank","remove","set","shift","size_hint","size_hint","size_hint","size_hint","sub","sub_assign","symmetric_difference","to","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_string","to_string","to_string","to_string","to_string","to_string","to_string","to_string","toggle","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","union","xs","Position","attack_info","board","borrow","borrow_mut","castling","clone","clone_into","deref","deref_mut","drop","empty","en_passant_square","fen","fmt","fmt","from","from_fen","fullmove_counter","generate_bishop_moves","generate_castle_moves","generate_king_moves","generate_knight_moves","generate_moves","generate_pawn_moves","generate_rook_moves","halfmove_clock","has_insufficient_material","init","into","is_legal","make_move","occupancy","occupied_squares","perft","pieces","side_to_move","starting","they","to_owned","to_string","try_from","try_from","try_into","type_id","us","validate","evaluator","Evaluator","uci","run","sanitize_fen"],"q":[[0,"pabi"],[6,"pabi::chess"],[10,"pabi::chess::attacks"],[62,"pabi::chess::bitboard"],[179,"pabi::chess::core"],[656,"pabi::chess::position"],[703,"pabi::evaluation"],[704,"pabi::evaluation::evaluator"],[705,"pabi::interface"],[706,"pabi::interface::uci"],[707,"pabi::util"],[708,"core::fmt"],[709,"core::fmt"],[710,"core::any"],[711,"core::option"],[712,"rayon::iter::par_bridge"],[713,"alloc::string"],[714,"anyhow"],[715,"core::cmp"],[716,"core::iter::traits::collect"],[717,"core::hash"],[718,"bitflags::iter"],[719,"bitflags::iter"]],"d":["","Implementation of chess environment, its rules and …","","Interface between the engine and the front-end (tournament …","Prints information about the host system.","Convenient utility functions for Pabi that can be used …","Mappings of occupied squares to the attacked squares for …","Bitboard-based representation for …","Chess primitives commonly used within crate::chess.","Provides fully-specified Chess Position implementation: …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","","Calls U::from(self).","","","","","","","","","","","","","","","","Represents a set of squares and provides common operations …","Iterates over set squares in a given Bitboard from least …","Piece-centric implementation of the chess board. This is …","","Piece-centric representation of all material owned by one …","","","","","","","","","","","","Returns raw bits.","","","","","","","","","","","","","Adds given square to the set.","","","","","","","","Returns true if this bitboard contains given square.","","","","","","","","","","","","","","Constructs a bitboard representing empty set of squares.","","","","","","Adds given square to the set.","","Prints board representation in FEN format.","Dumps the board in a simple format (‘.’ for empty …","Returns the argument unchanged.","Returns the argument unchanged.","","Returns the argument unchanged.","Returns the argument unchanged.","Constructs Bitboard from pre-calculated bits.","","Constructs a bitboard representing the universal set, it …","","","","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","An efficient way to iterate over the set squares.","","","","","","","Returns complement set of Self, i.e. flipping the set …","","","","","","","Shifts the bits to the left and ignores overflow.","Shifts the bits to the right and ignores overflow.","","Relative component, i.e. Result = LHS \\\\ RHS.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Track the ability to castle each side (kingside is often …","","","","","","","","","","Directions on the board from a perspective of White player.","An iterator over the variants of Direction","Also known as South.","","","","","","","","","","","","","","","","","","","","Represents a column (vertical row) of the chessboard. In …","An iterator over the variants of File","","","","","","","","","","","","","","","","","","","","","","","","Size of MoveList and an upper bound of moves in a chess …","Represents any kind of a legal chess move. A move is the …","Moves are stored on stack to avoid memory allocations. …","","","","Represents a specific piece owned by a player.","Standard chess pieces.","A standard game of chess is played between two players: …","A pawn can be promoted to a queen, rook, bishop or a …","","","Represents a horizontal row of the chessboard. In chess …","An iterator over the variants of Rank","","","","","Board squares: from left to right, from bottom to the top (…","An iterator over the variants of Square","","","Also known as North.","","","","","Get a flags value with all known bits set.","","","","","","The bitwise and (&) of the bits in two flags values.","The bitwise and (&) of the bits in two flags values.","The bitwise or (|) of the bits in two flags values.","The bitwise or (|) of the bits in two flags values.","","Get the underlying bits value.","The bitwise exclusive-or (^) of the bits in two flags …","The bitwise exclusive-or (^) of the bits in two flags …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","The bitwise negation (!) of the bits in a flags value, …","Whether all set bits in a source flags value are also set …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","The intersection of a source flags value with the …","","","","","","","","","","","","","","","Get a flags value with all bits unset.","","","","","","","","The bitwise or (|) of the bits in each flags value.","Returns file (column) on which the square is located.","","Serializes a move in UCI format.","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Convert from a bits value.","","Convert from a bits value exactly.","Convert from a bits value, unsetting any unknown bits.","The bitwise or (|) of the bits in each flags value.","Get a flags value with the bits of a flag with the given …","","","","","","","","","","","","","","","","","","","","","","","","","The bitwise or (|) of the bits in two flags values.","The bitwise and (&) of the bits in two flags values.","Whether any set bits in a source flags value are also set …","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","Whether all known bits in this flags value are set.","Whether all bits in this flags value are unset.","","","","Yield a set of contained flags values.","","Yield a set of contained named flags values.","","","","","","","","","","","Returns a pre-calculated bitboard mask with 1s set for …","Returns a pre-calculated bitboard mask with 1s set for …","","","Connects file (column) and rank (row) to form a full …","","","","","","","","","The bitwise negation (!) of the bits in a flags value, …","","","","","“Flips” the color.","","","","","","","","","","","","","","","Returns rank (row) on which the square is located.","The intersection of a source flags value with the …","Call insert when value is true or remove when value is …","","","","","","The intersection of a source flags value with the …","The intersection of a source flags value with the …","The bitwise exclusive-or (^) of the bits in two flags …","","","","","","","","","","","","","","","","","","","","","","","The bitwise exclusive-or (^) of the bits in two flags …","","","","","","Creates a square given its position on the board.","","","","","","","","","","","","","Parses CastleRights for both players from the FEN format. …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","The bitwise or (|) of the bits in two flags values.","","State of the chess game: board, half-move counters and …","","","","","","","","","","","","","Returns a string representation of the position in FEN …","Prints board in Forsyth-Edwards Notation.","","Returns the argument unchanged.","Parses board from Forsyth-Edwards Notation and checks its …","","","","","","Calculates a list of legal moves (i.e. the moves that do …","","","Halfmove Clock keeps track of the number of (half-)moves …","","","Calls U::from(self).","","","","","Perft (performance testing) is a technique for checking …","","","Creates the starting position of the standard chess.","","","","","","","","","","","","","",""],"i":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,5,5,5,5,5,5,5,5,5,5,0,0,5,0,0,5,0,0,0,0,5,5,5,5,5,0,0,0,0,0,0,9,3,9,15,9,3,3,9,3,3,3,20,3,3,15,20,3,9,15,20,3,9,15,3,9,3,9,15,3,9,15,3,3,20,3,9,15,20,3,9,15,20,3,9,15,3,9,15,3,9,15,3,3,15,15,20,3,3,9,15,3,3,3,3,20,3,9,15,20,3,9,15,20,3,3,9,9,20,9,9,20,3,20,9,15,9,9,3,3,3,15,3,3,3,9,15,15,20,3,9,15,20,3,3,9,15,20,3,9,15,15,30,2,2,2,2,2,2,2,2,25,30,2,2,2,2,2,2,2,2,25,25,25,0,0,13,33,8,30,2,2,2,2,2,2,2,2,0,30,2,2,2,2,2,2,2,2,0,0,22,30,2,2,2,2,2,2,2,2,26,30,2,2,2,2,2,2,2,2,0,0,26,26,30,2,2,2,2,2,2,2,2,30,2,2,2,2,2,2,2,2,13,13,33,0,0,0,25,26,13,0,0,0,0,13,33,0,0,13,33,26,26,0,0,26,26,22,25,25,25,8,25,29,31,32,34,26,25,25,25,25,25,25,25,25,16,28,29,2,30,31,26,32,8,13,25,33,22,34,16,28,29,2,30,31,26,32,8,13,25,33,22,34,28,29,2,30,31,26,32,8,13,25,33,22,34,28,29,2,30,31,26,32,8,13,25,33,22,34,2,30,26,25,25,16,28,29,2,30,31,26,32,8,13,25,33,22,34,16,28,29,2,30,31,26,32,8,13,25,33,22,34,25,16,28,29,2,30,31,26,32,8,13,25,33,22,34,25,2,30,26,8,13,25,33,25,2,16,28,28,29,2,2,30,30,31,26,26,32,8,8,13,13,25,25,25,25,25,25,33,22,34,16,28,29,2,30,31,26,32,8,13,13,25,33,22,34,28,25,25,25,25,25,25,28,29,31,32,34,25,29,31,32,34,16,28,29,2,30,31,26,32,8,13,25,33,22,34,25,25,25,16,28,29,2,30,31,26,32,8,13,25,33,22,34,29,31,32,25,34,25,25,2,30,26,25,22,25,16,29,31,32,34,45,29,31,32,34,30,26,25,28,2,29,31,32,34,29,31,32,34,25,29,31,32,34,8,22,16,29,31,32,34,2,30,26,13,33,26,28,8,2,25,25,2,29,31,32,34,25,25,25,28,28,29,2,30,31,26,32,8,13,25,33,22,34,16,28,2,30,26,8,13,25,25,16,16,28,29,2,2,2,30,30,30,31,26,26,26,32,8,8,13,25,25,33,22,34,16,28,29,2,30,31,26,32,8,13,25,33,22,34,16,28,29,2,30,31,26,32,8,13,25,33,22,34,25,45,0,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,0,0,0,0,39,0,0,39,39,39,39,39,39,39,39,0,39,39,39,39,39,39,39,39,39,39,39,0,0,0,0,0,0],"f":"````{{}b}``````````````````````````````{{df}f}{{dd}f}{ce{}{}}0`{hc{}}0{hb}{{jl}n}{cc{}}{{}h}5{df}0{{A`Abdff}j}{{dA`}f}{{AdAd}Ad}`;:;:`{c{{Af{e}}}{}{}}0{cAh{}}```````{Abf}{fd}{{Abd}{{Al{Aj}}}}{{And}{{Al{B`}}}}`{{ff}c{}}{{ff}b}{{AbAj}f}21{fAd}``3`{ce{}{}}0000000{{fd}b}{{Abd}b}{ff}{AbAb}{AnAn}{{ce}b{}{}}00{{fd}Bb}{fBd}{hc{}}0000000{hb}000{{}f}{{}Ab}{{}An}{{ff}Bb}{{AbAb}Bb}{{AnAn}Bb}?{{fl}n}{{Anl}n}0{cc{}}0{df}11{Adf}{{{Bf{d}}}f};{fBb}{{}h}000{ce{}{}}00002{fBh}``{Bhh}??{Bh{{Al{c}}}{}}{fc{}}{c{{Bj{e}}}{}{}}`{{AnA`}Ab}``{{fBl}f}{{fBd}c{}}0{{}An}{{ff}c{}}{{ff}b};;;{cBn{}}{c{{Af{e}}}{}{}}00000{f{{C`{d}}}}11{cAh{}}000`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````{{}Cb}````{A`Cd}{{CbCb}Cb}{{CbCb}b}10{CbCf}021{ce{}{}}000000000000000000000000000{ChCh}{CjCj}{dd}{ClCl}{CnCn}{CdCd}{D`D`}{A`A`}{AjAj}{CbCb}{DbDb}{BlBl}{DdDd}{{ce}b{}{}}000000000000{{dd}Df}{{ClCl}Df}{{CdCd}Df}7{{CbCb}Bb}{hc{}}000000000000000000000000000{{CbCb}Cb}{hb}0000000000000{{}Cb}{{dd}Bb}{{ClCl}Bb}{{CdCd}Bb}{{A`A`}Bb}{{AjAj}Bb}9{{DbDb}Bb}{{Cbc}b{{Dj{}{{Dh{Cb}}}}}}{dCl}{{B`l}n}{{Chl}n}0{{Cjl}n}{{dl}n}0{{Cll}n}0{{Cnl}n}{{Cdl}n}0{{D`l}n}{{A`l}n}0{{Ajl}n}0{{Cbl}n}00000{{Dbl}n}{{Bll}n}{{Ddl}n}{cc{}}000000000{DbAj}1111`{Cf{{Al{Cb}}}}{CfCb}00{cCb{{Dj{}{{Dh{Cb}}}}}}{Dl{{Al{Cb}}}}{DnCh}{{Cjh}{{Al{d}}}}{{Cnh}{{Al{Cl}}}}{{D`h}{{Al{Cd}}}}{{Ddh}{{Al{Bl}}}}{{Cbc}bE`}````{{}h}0000000000000{{CbCb}b}{{CbCb}Cb}{{CbCb}Bb}{ce{}{}}0000000000000000{Cbc{}}1{CbBb}0{{}Cj}{{}Cn}{{}D`}{Cb{{Eb{Cb}}}}{{}Dd}{Cb{{Ed{Cb}}}}`{Cjh}{Cnh}{D`h}{Ddh}`````{Clf}{Cdf}{A`Cb}{{dd{Al{Db}}}Ch}{{ClCd}d}{Cj{{Al{c}}}{}}{Cn{{Al{c}}}{}}{D`{{Al{c}}}{}}{Dd{{Al{c}}}{}}3210{CbCb}{{Cjh}{{Al{c}}}{}}{{Cnh}{{Al{c}}}{}}{{D`h}{{Al{c}}}{}}{{Ddh}{{Al{c}}}{}}{A`A`}{BlBl}`{c{{Bj{e}}}{}{}}000{{dd}{{Al{Df}}}}{{ClCl}{{Al{Df}}}}{{CdCd}{{Al{Df}}}}{{AjAj}{{Al{Df}}}}{{DbDb}{{Al{Df}}}}{A`Cd}`{A`Bl}{dCd}{{CbCb}b}{{CbCbBb}b}{{dBl}{{Al{d}}}}{Cj{{Ef{h{Al{h}}}}}}{Cn{{Ef{h{Al{h}}}}}}{D`{{Ef{h{Al{h}}}}}}{Dd{{Ef{h{Al{h}}}}}}{{CbCb}Cb}70`{ce{}{}}000000000000{cBn{}}00000009{Eh{{C`{B`}}}}{c{{Af{e}}}{}{}}00{Dl{{C`{d}}}}{Cf{{C`{d}}}}2{Cf{{C`{Cl}}}}3{Eh{{C`{Cl}}}}44{Cf{{C`{Cd}}}}{Eh{{C`{Cd}}}}66{Dl{{C`{A`}}}}7{Dl{{C`{Cb}}}}888888888888888888{cAh{}}0000000000000=``{Dnj}`==`{DnDn}{{ce}b{}{}}{hc{}}0{hb}{{}Dn}`{DnBn}{{Dnl}n}0{cc{}}{Dl{{C`{Dn}}}}`{{fffffdEj}b}{{A`fCbffEj}b}{{dfEj}b}{{ffffEj}b}{DnEj}{{fA`A`Abfffffd{Al{d}}fEj}b}5`{DnBb}{{}h}{ce{}{}}2{{DnCh}b}{{DnA`}f}{Dnf}{{DnCf}Ad}{{DnA`}Ab}`{{}Dn}{DnA`}7{cBn{}}{Dl{{C`{Dn}}}}{c{{Af{e}}}{}{}}0{cAh{}}4{Dn{{C`{b}}}}```{{}b}{DlBn}","c":[],"p":[[1,"unit"],[6,"Square",179],[5,"Bitboard",62],[1,"usize"],[5,"AttackInfo",10],[5,"Formatter",708],[8,"Result",708],[6,"Player",179],[5,"Pieces",62],[1,"u64"],[6,"Result",709],[5,"TypeId",710],[6,"PieceKind",179],[6,"Option",711],[5,"Board",62],[5,"Piece",179],[1,"bool"],[1,"u32"],[1,"slice"],[5,"BitboardIterator",62],[5,"IterBridge",712],[6,"Direction",179],[5,"String",713],[8,"Result",714],[5,"CastleRights",179],[6,"Rank",179],[1,"u8"],[5,"Move",179],[5,"SquareIter",179],[6,"File",179],[5,"FileIter",179],[5,"RankIter",179],[6,"Promotion",179],[5,"DirectionIter",179],[6,"Ordering",715],[17,"Item"],[10,"IntoIterator",716],[1,"str"],[5,"Position",656],[10,"Hasher",717],[5,"Iter",718],[5,"IterNames",718],[1,"tuple"],[1,"char"],[8,"MoveList",179]],"b":[[121,"impl-Display-for-Board"],[122,"impl-Debug-for-Board"],[309,"impl-Flags-for-CastleRights"],[310,"impl-CastleRights"],[426,"impl-Display-for-Move"],[427,"impl-Debug-for-Move"],[429,"impl-Display-for-Square"],[430,"impl-Debug-for-Square"],[431,"impl-Debug-for-File"],[432,"impl-Display-for-File"],[434,"impl-Display-for-Rank"],[435,"impl-Debug-for-Rank"],[437,"impl-Display-for-Player"],[438,"impl-Debug-for-Player"],[439,"impl-Display-for-PieceKind"],[440,"impl-Debug-for-PieceKind"],[441,"impl-Binary-for-CastleRights"],[442,"impl-LowerHex-for-CastleRights"],[443,"impl-Display-for-CastleRights"],[444,"impl-UpperHex-for-CastleRights"],[445,"impl-Debug-for-CastleRights"],[446,"impl-Octal-for-CastleRights"],[467,"impl-Flags-for-CastleRights"],[468,"impl-CastleRights"],[607,"impl-TryFrom%3C%26str%3E-for-Square"],[608,"impl-TryFrom%3Cu8%3E-for-Square"],[610,"impl-TryFrom%3Cu8%3E-for-File"],[612,"impl-TryFrom%3Cchar%3E-for-File"],[615,"impl-TryFrom%3Cu8%3E-for-Rank"],[616,"impl-TryFrom%3Cchar%3E-for-Rank"],[670,"impl-Display-for-Position"],[671,"impl-Debug-for-Position"]]}]\ +]')); +if (typeof exports !== 'undefined') exports.searchIndex = searchIndex; +else if (window.initSearch) window.initSearch(searchIndex); diff --git a/docs/settings.html b/docs/settings.html new file mode 100644 index 00000000..0d2f6334 --- /dev/null +++ b/docs/settings.html @@ -0,0 +1,2 @@ +Settings +

Rustdoc settings

Back
\ No newline at end of file diff --git a/docs/src-files.js b/docs/src-files.js new file mode 100644 index 00000000..3e8a4010 --- /dev/null +++ b/docs/src-files.js @@ -0,0 +1,4 @@ +var srcIndex = new Map(JSON.parse('[\ +["pabi",["",[["chess",[],["attacks.rs","bitboard.rs","core.rs","position.rs"]],["evaluation",[],["evaluator.rs"]],["interface",[],["uci.rs"]]],["chess.rs","evaluation.rs","interface.rs","lib.rs","util.rs"]]]\ +]')); +createSrcSidebar(); diff --git a/docs/src/pabi/chess.rs.html b/docs/src/pabi/chess.rs.html new file mode 100644 index 00000000..2d5e7b89 --- /dev/null +++ b/docs/src/pabi/chess.rs.html @@ -0,0 +1,15 @@ +chess.rs - source +
1
+2
+3
+4
+5
+6
+
//! Implementation of chess environment, its rules and specifics.
+
+pub mod attacks;
+pub mod bitboard;
+pub mod core;
+pub mod position;
+
\ No newline at end of file diff --git a/docs/src/pabi/chess/attacks.rs.html b/docs/src/pabi/chess/attacks.rs.html new file mode 100644 index 00000000..a5e91e5f --- /dev/null +++ b/docs/src/pabi/chess/attacks.rs.html @@ -0,0 +1,1477 @@ +attacks.rs - source +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+
//! Mappings of occupied squares to the attacked squares for each piece. The
+//! mappings are pre-calculated where possible to provide an efficient way of
+//! generating moves.
+// TODO: This code is probably by far the less appealing in the project.
+// Refactor it and make it nicer.
+
+use crate::chess::bitboard::{Bitboard, Pieces};
+use crate::chess::core::{Player, Square, BOARD_SIZE};
+
+pub(super) fn king_attacks(from: Square) -> Bitboard {
+    KING_ATTACKS[from as usize]
+}
+
+pub(super) fn queen_attacks(from: Square, occupancy: Bitboard) -> Bitboard {
+    bishop_attacks(from, occupancy) | rook_attacks(from, occupancy)
+}
+
+pub(super) fn rook_attacks(from: Square, occupancy: Bitboard) -> Bitboard {
+    ROOK_ATTACKS[ROOK_ATTACK_OFFSETS[from as usize]
+        + pext(occupancy.bits(), ROOK_RELEVANT_OCCUPANCIES[from as usize]) as usize]
+}
+
+pub(super) fn bishop_attacks(from: Square, occupancy: Bitboard) -> Bitboard {
+    BISHOP_ATTACKS[BISHOP_ATTACK_OFFSETS[from as usize]
+        + pext(occupancy.bits(), BISHOP_RELEVANT_OCCUPANCIES[from as usize]) as usize]
+}
+
+pub(super) fn knight_attacks(square: Square) -> Bitboard {
+    KNIGHT_ATTACKS[square as usize]
+}
+
+pub(super) fn pawn_attacks(square: Square, player: Player) -> Bitboard {
+    match player {
+        Player::White => WHITE_PAWN_ATTACKS[square as usize],
+        Player::Black => BLACK_PAWN_ATTACKS[square as usize],
+    }
+}
+
+pub(super) fn ray(from: Square, to: Square) -> Bitboard {
+    RAYS[(from as usize) * (BOARD_SIZE as usize) + to as usize]
+}
+
+pub(super) fn bishop_ray(from: Square, to: Square) -> Bitboard {
+    BISHOP_RAYS[(from as usize) * (BOARD_SIZE as usize) + to as usize]
+}
+
+fn rook_ray(from: Square, to: Square) -> Bitboard {
+    ROOK_RAYS[(from as usize) * (BOARD_SIZE as usize) + to as usize]
+}
+
+// TODO: Document.
+fn pext(a: u64, mask: u64) -> u64 {
+    if cfg!(target_feature = "bmi2") {
+        unsafe { core::arch::x86_64::_pext_u64(a, mask) }
+    } else {
+        let mut result = 0u64;
+        let mut mask = mask;
+        let mut scanning_bit = 1u64;
+        while mask != 0 {
+            let ls1b = 1u64 << mask.trailing_zeros();
+            if (a & ls1b) != 0 {
+                result |= scanning_bit;
+            }
+            mask ^= ls1b;
+            scanning_bit <<= 1;
+        }
+        result
+    }
+}
+
+#[derive(Debug)]
+pub(super) struct AttackInfo {
+    pub(super) attacks: Bitboard,
+    pub(super) checkers: Bitboard,
+    pub(super) pins: Bitboard,
+    // TODO: Get rid of the XRays.
+    pub(super) xrays: Bitboard,
+    pub(super) safe_king_squares: Bitboard,
+}
+
+impl AttackInfo {
+    // TODO: Handle each piece separately.
+    pub(super) fn new(
+        they: Player,
+        their: &Pieces,
+        king: Square,
+        our_occupancy: Bitboard,
+        occupancy: Bitboard,
+    ) -> Self {
+        let mut result = Self {
+            attacks: Bitboard::empty(),
+            checkers: Bitboard::empty(),
+            pins: Bitboard::empty(),
+            xrays: Bitboard::empty(),
+            safe_king_squares: Bitboard::empty(),
+        };
+        result.safe_king_squares = !our_occupancy & king_attacks(king);
+        let occupancy_without_king = occupancy - Bitboard::from(king);
+        // King.
+        let their_king = their.king.as_square();
+        result.attacks |= king_attacks(their_king);
+        // Knights.
+        for knight in their.knights.iter() {
+            let targets = knight_attacks(knight);
+            result.attacks |= targets;
+            if targets.contains(king) {
+                result.checkers.extend(knight);
+            }
+        }
+        // Pawns.
+        for pawn in their.pawns.iter() {
+            let targets = pawn_attacks(pawn, they);
+            result.attacks |= targets;
+            if targets.contains(king) {
+                result.checkers.extend(pawn);
+            }
+        }
+        // Queens.
+        // TODO: Sliders repeat each other. Pull this into a function.
+        for queen in their.queens.iter() {
+            let targets = queen_attacks(queen, occupancy);
+            result.attacks |= targets;
+            if targets.contains(king) {
+                result.checkers.extend(queen);
+                result.safe_king_squares -= queen_attacks(queen, occupancy_without_king);
+                // An attack can be either a check or a (potential) pin, not
+                // both.
+                continue;
+            }
+            let attack_ray = ray(queen, king);
+            let blocker = (attack_ray & occupancy) - Bitboard::from(queen);
+            if blocker.count() == 1 {
+                if (blocker & our_occupancy).has_any() {
+                    result.pins |= blocker;
+                } else {
+                    result.xrays |= blocker;
+                }
+            }
+        }
+        for bishop in their.bishops.iter() {
+            let targets = bishop_attacks(bishop, occupancy);
+            result.attacks |= targets;
+            if targets.contains(king) {
+                result.checkers.extend(bishop);
+                result.safe_king_squares -= bishop_attacks(bishop, occupancy_without_king);
+                // An attack can be either a check or a (potential) pin, not
+                // both.
+                continue;
+            }
+            let attack_ray = bishop_ray(bishop, king);
+            let blocker = (attack_ray & occupancy) - Bitboard::from(bishop);
+            if blocker.count() == 1 {
+                if (blocker & our_occupancy).has_any() {
+                    result.pins |= blocker;
+                } else {
+                    result.xrays |= blocker;
+                }
+            }
+        }
+        for rook in their.rooks.iter() {
+            let targets = rook_attacks(rook, occupancy);
+            result.attacks |= targets;
+            if targets.contains(king) {
+                result.checkers.extend(rook);
+                result.safe_king_squares -= rook_attacks(rook, occupancy_without_king);
+                // An attack can be either a check or a (potential) pin, not
+                // both.
+                continue;
+            }
+            let attack_ray = rook_ray(rook, king);
+            let blocker = (attack_ray & occupancy) - Bitboard::from(rook);
+            if blocker.count() == 1 {
+                if (blocker & our_occupancy).has_any() {
+                    result.pins |= blocker;
+                } else {
+                    result.xrays |= blocker;
+                }
+            }
+        }
+        result.safe_king_squares -= result.attacks;
+        result
+    }
+}
+
+// Generated in build.rs.
+// TODO: Document PEXT bitboards.
+const BISHOP_ATTACKS_COUNT: usize = 5248;
+const BISHOP_ATTACKS: [Bitboard; BISHOP_ATTACKS_COUNT] = include!(concat!(
+    env!("CARGO_MANIFEST_DIR"),
+    "/generated/bishop_attacks.rs"
+));
+const BISHOP_ATTACK_OFFSETS: [usize; BOARD_SIZE as usize] = include!(concat!(
+    env!("CARGO_MANIFEST_DIR"),
+    "/generated/bishop_attack_offsets.rs"
+));
+const BISHOP_RELEVANT_OCCUPANCIES: [u64; BOARD_SIZE as usize] = include!(concat!(
+    env!("CARGO_MANIFEST_DIR"),
+    "/generated/bishop_relevant_occupancies.rs"
+));
+
+const ROOK_ATTACKS_COUNT: usize = 102_400;
+const ROOK_ATTACKS: [Bitboard; ROOK_ATTACKS_COUNT] = include!(concat!(
+    env!("CARGO_MANIFEST_DIR"),
+    "/generated/rook_attacks.rs"
+));
+const ROOK_RELEVANT_OCCUPANCIES: [u64; BOARD_SIZE as usize] = include!(concat!(
+    env!("CARGO_MANIFEST_DIR"),
+    "/generated/rook_relevant_occupancies.rs"
+));
+const ROOK_ATTACK_OFFSETS: [usize; BOARD_SIZE as usize] = include!(concat!(
+    env!("CARGO_MANIFEST_DIR"),
+    "/generated/rook_attack_offsets.rs"
+));
+
+const RAYS: [Bitboard; BOARD_SIZE as usize * BOARD_SIZE as usize] =
+    include!(concat!(env!("CARGO_MANIFEST_DIR"), "/generated/rays.rs"));
+const BISHOP_RAYS: [Bitboard; BOARD_SIZE as usize * BOARD_SIZE as usize] = include!(concat!(
+    env!("CARGO_MANIFEST_DIR"),
+    "/generated/bishop_rays.rs"
+));
+const ROOK_RAYS: [Bitboard; BOARD_SIZE as usize * BOARD_SIZE as usize] = include!(concat!(
+    env!("CARGO_MANIFEST_DIR"),
+    "/generated/rook_rays.rs"
+));
+
+const KNIGHT_ATTACKS: [Bitboard; BOARD_SIZE as usize] = include!(concat!(
+    env!("CARGO_MANIFEST_DIR"),
+    "/generated/knight_attacks.rs"
+));
+const KING_ATTACKS: [Bitboard; BOARD_SIZE as usize] = include!(concat!(
+    env!("CARGO_MANIFEST_DIR"),
+    "/generated/king_attacks.rs"
+));
+const WHITE_PAWN_ATTACKS: [Bitboard; BOARD_SIZE as usize] = include!(concat!(
+    env!("CARGO_MANIFEST_DIR"),
+    "/generated/white_pawn_attacks.rs"
+));
+const BLACK_PAWN_ATTACKS: [Bitboard; BOARD_SIZE as usize] = include!(concat!(
+    env!("CARGO_MANIFEST_DIR"),
+    "/generated/black_pawn_attacks.rs"
+));
+
+// TODO: Abstract it out and support Fischer Random Chess.
+pub(super) const WHITE_SHORT_CASTLE_KING_WALK: Bitboard =
+    Bitboard::from_bits(0x0000_0000_0000_0060);
+pub(super) const WHITE_SHORT_CASTLE_ROOK_WALK: Bitboard =
+    Bitboard::from_bits(0x0000_0000_0000_0060);
+pub(super) const WHITE_LONG_CASTLE_KING_WALK: Bitboard = Bitboard::from_bits(0x0000_0000_0000_000C);
+pub(super) const WHITE_LONG_CASTLE_ROOK_WALK: Bitboard = Bitboard::from_bits(0x0000_0000_0000_000E);
+pub(super) const BLACK_SHORT_CASTLE_KING_WALK: Bitboard =
+    Bitboard::from_bits(0x6000_0000_0000_0000);
+pub(super) const BLACK_SHORT_CASTLE_ROOK_WALK: Bitboard =
+    Bitboard::from_bits(0x6000_0000_0000_0000);
+pub(super) const BLACK_LONG_CASTLE_KING_WALK: Bitboard = Bitboard::from_bits(0x0C00_0000_0000_0000);
+pub(super) const BLACK_LONG_CASTLE_ROOK_WALK: Bitboard = Bitboard::from_bits(0x0E00_0000_0000_0000);
+
+#[cfg(test)]
+mod test {
+    use pretty_assertions::assert_eq;
+    use strum::IntoEnumIterator;
+
+    use super::*;
+    use crate::chess::core::Rank;
+    use crate::chess::position::Position;
+
+    #[test]
+    fn sliders() {
+        let occupancy = Bitboard::from_squares(&[
+            Square::F4,
+            Square::C4,
+            Square::A4,
+            Square::B1,
+            Square::D5,
+            Square::G5,
+            Square::G6,
+            Square::E8,
+            Square::E2,
+        ]);
+        assert_eq!(
+            format!("{:?}", occupancy),
+            ". . . . 1 . . .\n\
+            . . . . . . . .\n\
+            . . . . . . 1 .\n\
+            . . . 1 . . 1 .\n\
+            1 . 1 . . 1 . .\n\
+            . . . . . . . .\n\
+            . . . . 1 . . .\n\
+            . 1 . . . . . ."
+        );
+        assert_eq!(
+            format!(
+                "{:?}",
+                Bitboard::from_bits(BISHOP_RELEVANT_OCCUPANCIES[Square::E4 as usize])
+            ),
+            ". . . . . . . .\n\
+            . 1 . . . . . .\n\
+            . . 1 . . . 1 .\n\
+            . . . 1 . 1 . .\n\
+            . . . . . . . .\n\
+            . . . 1 . 1 . .\n\
+            . . 1 . . . 1 .\n\
+            . . . . . . . ."
+        );
+        let attacks = bishop_attacks(Square::E4, occupancy);
+        println!("{:064b}", attacks.bits());
+        assert_eq!(
+            format!("{:?}", attacks),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . 1 .\n\
+            . . . 1 . 1 . .\n\
+            . . . . . . . .\n\
+            . . . 1 . 1 . .\n\
+            . . 1 . . . 1 .\n\
+            . 1 . . . . . 1"
+        );
+        assert_eq!(
+            format!(
+                "{:?}",
+                Bitboard::from_bits(ROOK_RELEVANT_OCCUPANCIES[Square::E4 as usize])
+            ),
+            ". . . . . . . .\n\
+            . . . . 1 . . .\n\
+            . . . . 1 . . .\n\
+            . . . . 1 . . .\n\
+            . 1 1 1 . 1 1 .\n\
+            . . . . 1 . . .\n\
+            . . . . 1 . . .\n\
+            . . . . . . . ."
+        );
+        let attacks = rook_attacks(Square::E4, occupancy);
+        println!("{:064b}", attacks.bits());
+        assert_eq!(
+            format!("{:?}", attacks),
+            ". . . . 1 . . .\n\
+            . . . . 1 . . .\n\
+            . . . . 1 . . .\n\
+            . . . . 1 . . .\n\
+            . . 1 1 . 1 . .\n\
+            . . . . 1 . . .\n\
+            . . . . 1 . . .\n\
+            . . . . . . . ."
+        );
+    }
+
+    #[test]
+    fn king() {
+        assert_eq!(
+            format!("{:?}", king_attacks(Square::A1)),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            1 1 . . . . . .\n\
+            . 1 . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", king_attacks(Square::H3)),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . 1 1\n\
+            . . . . . . 1 .\n\
+            . . . . . . 1 1\n\
+            . . . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", king_attacks(Square::D4)),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . 1 1 1 . . .\n\
+            . . 1 . 1 . . .\n\
+            . . 1 1 1 . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", king_attacks(Square::F8)),
+            ". . . . 1 . 1 .\n\
+            . . . . 1 1 1 .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+    }
+
+    #[test]
+    fn knight() {
+        assert_eq!(
+            format!("{:?}", knight_attacks(Square::A1)),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . 1 . . . . . .\n\
+            . . 1 . . . . .\n\
+            . . . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", knight_attacks(Square::B1)),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            1 . 1 . . . . .\n\
+            . . . 1 . . . .\n\
+            . . . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", knight_attacks(Square::H3)),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . 1 .\n\
+            . . . . . 1 . .\n\
+            . . . . . . . .\n\
+            . . . . . 1 . .\n\
+            . . . . . . 1 ."
+        );
+        assert_eq!(
+            format!("{:?}", knight_attacks(Square::D4)),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . 1 . 1 . . .\n\
+            . 1 . . . 1 . .\n\
+            . . . . . . . .\n\
+            . 1 . . . 1 . .\n\
+            . . 1 . 1 . . .\n\
+            . . . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", knight_attacks(Square::F8)),
+            ". . . . . . . .\n\
+            . . . 1 . . . 1\n\
+            . . . . 1 . 1 .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+    }
+
+    #[test]
+    fn pawn() {
+        // Pawns can not be on the back ranks, hence the attack maps are empty.
+        for square in Rank::One.mask().iter().chain(Rank::Eight.mask().iter()) {
+            assert!(pawn_attacks(square, Player::White).is_empty());
+            assert!(pawn_attacks(square, Player::Black).is_empty());
+        }
+        assert_eq!(
+            format!("{:?}", pawn_attacks(Square::A2, Player::White)),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . 1 . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", pawn_attacks(Square::A2, Player::Black)),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . 1 . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", pawn_attacks(Square::D4, Player::White)),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . 1 . 1 . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", pawn_attacks(Square::D4, Player::Black)),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . 1 . 1 . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", pawn_attacks(Square::H5, Player::White)),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . 1 .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", pawn_attacks(Square::H5, Player::Black)),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . 1 .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+    }
+
+    #[test]
+    fn rays() {
+        // Rays with source == destination don't exist.
+        for square in Square::iter() {
+            assert!(ray(square, square).is_empty());
+        }
+        // Rays don't exist for squares not on the same diagonal or vertical.
+        assert!(ray(Square::A1, Square::B3).is_empty());
+        assert!(ray(Square::A1, Square::H7).is_empty());
+        assert!(ray(Square::B2, Square::H5).is_empty());
+        assert!(ray(Square::F2, Square::H8).is_empty());
+        assert_eq!(
+            format!("{:?}", ray(Square::B3, Square::F7)),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . 1 . . .\n\
+            . . . 1 . . . .\n\
+            . . 1 . . . . .\n\
+            . 1 . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", ray(Square::F7, Square::B3)),
+            ". . . . . . . .\n\
+            . . . . . 1 . .\n\
+            . . . . 1 . . .\n\
+            . . . 1 . . . .\n\
+            . . 1 . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", ray(Square::C8, Square::H8)),
+            ". . 1 1 1 1 1 .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", ray(Square::H1, Square::H8)),
+            ". . . . . . . .\n\
+            . . . . . . . 1\n\
+            . . . . . . . 1\n\
+            . . . . . . . 1\n\
+            . . . . . . . 1\n\
+            . . . . . . . 1\n\
+            . . . . . . . 1\n\
+            . . . . . . . 1"
+        );
+        assert_eq!(
+            format!("{:?}", ray(Square::E4, Square::B4)),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . 1 1 1 . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+    }
+
+    #[test]
+    fn basic_attack_info() {
+        let position = Position::try_from("3kn3/3p4/8/6B1/8/6K1/3R4/8 b - - 0 1").unwrap();
+        let attacks = position.attack_info();
+        assert_eq!(
+            format!("{:?}", attacks.attacks),
+            ". . . 1 . . . .\n\
+            . . . 1 1 . . .\n\
+            . . . 1 . 1 . 1\n\
+            . . . 1 . . . .\n\
+            . . . 1 . 1 1 1\n\
+            . . . 1 1 1 . 1\n\
+            1 1 1 1 1 1 1 1\n\
+            . . . 1 . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", attacks.checkers),
+            "\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . 1 .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", attacks.pins),
+            ". . . . . . . .\n\
+            . . . 1 . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+        assert!(attacks.xrays.is_empty());
+    }
+
+    #[test]
+    fn xrays() {
+        let position = Position::try_from("b6k/8/8/3p4/8/8/8/7K w - - 0 1").unwrap();
+        let attacks = position.attack_info();
+        assert_eq!(
+            format!("{:?}", attacks.attacks),
+            ". . . . . . 1 .\n\
+            . 1 . . . . 1 1\n\
+            . . 1 . . . . .\n\
+            . . . 1 . . . .\n\
+            . . 1 . 1 . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+        assert!(attacks.checkers.is_empty());
+        assert!(attacks.pins.is_empty());
+        assert_eq!(
+            format!("{:?}", attacks.xrays),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . 1 . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+    }
+
+    #[test]
+    fn rich_attack_info() {
+        let position =
+            Position::try_from("1k3q2/8/8/4PP2/q4K2/3nRBR1/3b1Nr1/5r2 w - - 0 1").unwrap();
+        let attacks = position.attack_info();
+        assert_eq!(
+            format!("{:?}", attacks.attacks),
+            "1 1 1 1 1 . 1 1\n\
+            1 1 1 1 1 1 1 .\n\
+            1 . 1 1 . 1 . 1\n\
+            1 1 1 . 1 1 . .\n\
+            . 1 1 1 1 1 . .\n\
+            1 1 1 . 1 . 1 .\n\
+            1 1 1 . . 1 . 1\n\
+            1 1 1 1 1 . 1 1"
+        );
+        assert_eq!(
+            format!("{:?}", attacks.checkers),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            1 . . . . . . .\n\
+            . . . 1 . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", attacks.pins),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . 1 . .\n\
+            . . . . . . . .\n\
+            . . . . 1 . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+        assert!(attacks.xrays.is_empty());
+    }
+
+    #[test]
+    fn complicated_attack_info() {
+        let position =
+            Position::try_from("2r3r1/3p3k/1p3pp1/1B5P/5P2/2P1pqP1/PP4KP/3R4 w - - 0 34").unwrap();
+        let attacks = position.attack_info();
+        assert_eq!(
+            format!("{:?}", attacks.checkers),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . 1 . .\n\
+            . . . . . . . .\n\
+            . . . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", attacks.safe_king_squares),
+            ". . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . . . .\n\
+            . . . . . 1 . 1\n\
+            . . . . . . . .\n\
+            . . . . . . 1 ."
+        );
+        assert!(attacks.xrays.is_empty());
+    }
+}
+
\ No newline at end of file diff --git a/docs/src/pabi/chess/bitboard.rs.html b/docs/src/pabi/chess/bitboard.rs.html new file mode 100644 index 00000000..ede08d93 --- /dev/null +++ b/docs/src/pabi/chess/bitboard.rs.html @@ -0,0 +1,1703 @@ +bitboard.rs - source +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+850
+
//! [`Bitboard`]-based representation for [`crate::chess::position::Position`].
+//! [Bitboards] utilize the fact that modern processors operate on 64 bit
+//! integers, and the bit operations can be performed simultaneously. This
+//! results in very efficient calculation of possible attack vectors and other
+//! meaningful features that are required to calculate possible moves and
+//! evaluate position. The disadvantage is complexity that comes with bitboard
+//! implementation and inefficiency of some operations like "get piece type on
+//! given square" (efficiently handled by Square-centric board implementations
+//! that can be used together bitboard-based approach to compensate its
+//! shortcomings).
+//!
+//! [Bitboards]: https://www.chessprogramming.org/Bitboards
+
+use std::fmt::Write;
+use std::ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, Not, Shl, Shr, Sub, SubAssign};
+use std::{fmt, mem};
+
+use itertools::Itertools;
+use strum::IntoEnumIterator;
+
+use crate::chess::core::{
+    Direction,
+    File,
+    Piece,
+    PieceKind,
+    Player,
+    Rank,
+    Square,
+    BOARD_SIZE,
+    BOARD_WIDTH,
+};
+
+/// Represents a set of squares and provides common operations (e.g. AND, OR,
+/// XOR) over these sets. Each bit corresponds to one of 64 squares of the chess
+/// board.
+///
+/// Mirroring [`Square`] semantics, the least significant
+/// bit corresponds to A1, and the most significant bit - to H8.
+///
+/// Bitboard is a thin wrapper around [u64].
+#[derive(Copy, Clone, PartialEq, Eq)]
+pub struct Bitboard {
+    bits: u64,
+}
+
+impl Bitboard {
+    /// Constructs Bitboard from pre-calculated bits.
+    #[must_use]
+    pub(super) const fn from_bits(bits: u64) -> Self {
+        Self { bits }
+    }
+
+    /// Constructs a bitboard representing empty set of squares.
+    #[must_use]
+    pub const fn empty() -> Self {
+        Self::from_bits(0)
+    }
+
+    /// Constructs a bitboard representing the universal set, it contains all
+    /// squares by setting all bits to binary one.
+    #[must_use]
+    pub const fn full() -> Self {
+        Self::from_bits(u64::MAX)
+    }
+
+    /// Returns raw bits.
+    #[must_use]
+    pub const fn bits(self) -> u64 {
+        self.bits
+    }
+
+    #[must_use]
+    pub(super) fn from_squares(squares: &[Square]) -> Self {
+        let mut result = Self::empty();
+        for square in squares {
+            result |= Self::from(*square);
+        }
+        result
+    }
+
+    /// Adds given square to the set.
+    pub(super) fn extend(&mut self, square: Square) {
+        *self |= Self::from(square)
+    }
+
+    /// Adds given square to the set.
+    pub(super) fn clear(&mut self, square: Square) {
+        *self &= !Self::from(square)
+    }
+
+    /// Returns true if this bitboard contains given square.
+    #[must_use]
+    pub(super) fn contains(self, square: Square) -> bool {
+        (self.bits & (1u64 << square as u8)) != 0
+    }
+
+    #[must_use]
+    pub(super) fn as_square(self) -> Square {
+        debug_assert!(self.bits.count_ones() == 1);
+        unsafe { std::mem::transmute(self.bits.trailing_zeros() as u8) }
+    }
+
+    #[must_use]
+    pub(super) fn count(self) -> u32 {
+        self.bits.count_ones()
+    }
+
+    #[must_use]
+    pub(super) fn is_empty(self) -> bool {
+        self.bits == 0
+    }
+
+    #[must_use]
+    pub(super) fn has_any(self) -> bool {
+        !self.is_empty()
+    }
+
+    #[must_use]
+    pub(super) fn shift(self, direction: Direction) -> Self {
+        match direction {
+            Direction::Up => self << u32::from(BOARD_WIDTH),
+            Direction::Down => self >> u32::from(BOARD_WIDTH),
+        }
+    }
+
+    /// An efficient way to iterate over the set squares.
+    #[must_use]
+    pub(super) fn iter(self) -> BitboardIterator {
+        BitboardIterator { bits: self.bits }
+    }
+}
+
+impl fmt::Debug for Bitboard {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        // TODO: This is quite verbose. Refactor or explain what is happening.
+        write!(
+            f,
+            "{}",
+            format!("{:#066b}", self.bits)
+                .chars()
+                .rev()
+                .take(BOARD_SIZE as usize)
+                .chunks(BOARD_WIDTH as usize)
+                .into_iter()
+                .map(|chunk| chunk
+                    .map(|ch| match ch {
+                        '1' => '1',
+                        '0' => '.',
+                        _ => unreachable!(),
+                    })
+                    .join(SQUARE_SEPARATOR))
+                .collect::<Vec<String>>()
+                .iter()
+                .rev()
+                .join(LINE_SEPARATOR)
+        )
+    }
+}
+
+impl BitOr for Bitboard {
+    type Output = Self;
+
+    fn bitor(self, rhs: Self) -> Self::Output {
+        Self::from_bits(self.bits.bitor(rhs.bits))
+    }
+}
+
+impl BitOrAssign for Bitboard {
+    fn bitor_assign(&mut self, rhs: Self) {
+        self.bits.bitor_assign(rhs.bits);
+    }
+}
+
+impl BitAnd for Bitboard {
+    type Output = Self;
+
+    fn bitand(self, rhs: Self) -> Self::Output {
+        Self::from_bits(self.bits.bitand(rhs.bits))
+    }
+}
+
+impl BitAndAssign for Bitboard {
+    fn bitand_assign(&mut self, rhs: Self) {
+        self.bits.bitand_assign(rhs.bits)
+    }
+}
+
+impl BitXor for Bitboard {
+    type Output = Self;
+
+    fn bitxor(self, rhs: Self) -> Self::Output {
+        Self::from_bits(self.bits.bitxor(rhs.bits))
+    }
+}
+
+impl Sub for Bitboard {
+    type Output = Self;
+
+    /// [Relative component], i.e. Result = LHS \ RHS.
+    ///
+    /// [Relative component]: https://en.wikipedia.org/wiki/Complement_%28set_theory%29#Relative_complement
+    fn sub(self, rhs: Self) -> Self::Output {
+        self & !rhs
+    }
+}
+
+impl SubAssign for Bitboard {
+    fn sub_assign(&mut self, rhs: Self) {
+        self.bitand_assign(!rhs)
+    }
+}
+
+impl Not for Bitboard {
+    type Output = Self;
+
+    /// Returns [complement
+    /// set](https://en.wikipedia.org/wiki/Complement_%28set_theory%29) of Self,
+    /// i.e. flipping the set squares to unset and vice versa.
+    fn not(self) -> Self::Output {
+        Self::from_bits(!self.bits)
+    }
+}
+
+impl Shl<u32> for Bitboard {
+    type Output = Self;
+
+    /// Shifts the bits to the left and ignores overflow.
+    fn shl(self, rhs: u32) -> Self::Output {
+        let (bits, _) = self.bits.overflowing_shl(rhs);
+        Self::from_bits(bits)
+    }
+}
+
+impl Shr<u32> for Bitboard {
+    type Output = Self;
+
+    /// Shifts the bits to the right and ignores overflow.
+    fn shr(self, rhs: u32) -> Self::Output {
+        let (bits, _) = self.bits.overflowing_shr(rhs);
+        Self::from_bits(bits)
+    }
+}
+
+impl From<Square> for Bitboard {
+    fn from(square: Square) -> Self {
+        Self::from_bits(1u64 << square as u8)
+    }
+}
+
+/// Iterates over set squares in a given [Bitboard] from least significant 1
+/// bits (LS1B) to most significant 1 bits (MS1B) through implementing
+/// [bitscan] forward operation.
+///
+/// [bitscan]: https://www.chessprogramming.org/BitScan
+// TODO: Try De Brujin Multiplication and see if it's faster (via benchmarks)
+// than trailing zeros as reported by some developers (even though intuitively
+// trailing zeros should be much faster because it would compile to a processor
+// instruction):
+// https://www.chessprogramming.org/BitScan#De_Bruijn_Multiplication
+pub(super) struct BitboardIterator {
+    bits: u64,
+}
+
+impl Iterator for BitboardIterator {
+    type Item = Square;
+
+    fn next(&mut self) -> Option<Self::Item> {
+        if self.bits == 0 {
+            return None;
+        }
+        // Get the LS1B and consume it from the iterator.
+        let next_index = self.bits.trailing_zeros();
+        self.bits ^= 1 << next_index;
+        // For performance reasons, it's better to convert directly: the
+        // conversion is safe because trailing_zeros() will return a number in
+        // 0..64 range.
+        Some(unsafe { mem::transmute(next_index as u8) })
+    }
+}
+
+impl ExactSizeIterator for BitboardIterator {
+    fn len(&self) -> usize {
+        self.bits.count_ones() as usize
+    }
+}
+
+impl TryInto<Square> for Bitboard {
+    type Error = anyhow::Error;
+
+    fn try_into(self) -> anyhow::Result<Square> {
+        if self.bits.count_ones() != 1 {
+            anyhow::bail!(
+                "bitboard should contain exactly 1 bit, got {}",
+                self.bits.count_ones()
+            );
+        }
+        Ok(unsafe { std::mem::transmute(self.bits.trailing_zeros() as u8) })
+    }
+}
+
+/// Piece-centric representation of all material owned by one player. Uses
+/// [Bitboard] to store a set of squares occupied by each piece. The main user
+/// is [`crate::chess::position::Position`], [Bitboard] is not very useful on
+/// its own.
+#[derive(Clone, PartialEq, Eq)]
+pub(super) struct Pieces {
+    pub(super) king: Bitboard,
+    pub(super) queens: Bitboard,
+    pub(super) rooks: Bitboard,
+    pub(super) bishops: Bitboard,
+    // TODO: Store "all" instead.
+    pub(super) knights: Bitboard,
+    pub(super) pawns: Bitboard,
+}
+
+impl Pieces {
+    pub(super) fn empty() -> Self {
+        Self {
+            king: Bitboard::empty(),
+            queens: Bitboard::empty(),
+            rooks: Bitboard::empty(),
+            bishops: Bitboard::empty(),
+            knights: Bitboard::empty(),
+            pawns: Bitboard::empty(),
+        }
+    }
+
+    pub(super) fn new_white() -> Self {
+        Self {
+            king: Square::E1.into(),
+            queens: Square::D1.into(),
+            rooks: Bitboard::from_squares(&[Square::A1, Square::H1]),
+            bishops: Bitboard::from_squares(&[Square::C1, Square::F1]),
+            knights: Bitboard::from_squares(&[Square::B1, Square::G1]),
+            pawns: Bitboard::from_squares(&[
+                Square::A2,
+                Square::B2,
+                Square::C2,
+                Square::D2,
+                Square::E2,
+                Square::F2,
+                Square::G2,
+                Square::H2,
+            ]),
+        }
+    }
+
+    pub(super) fn new_black() -> Self {
+        // TODO: Implement flip and return new_white().flip() to prevent copying
+        // code.
+        Self {
+            king: Square::E8.into(),
+            queens: Square::D8.into(),
+            rooks: Bitboard::from_squares(&[Square::A8, Square::H8]),
+            bishops: Bitboard::from_squares(&[Square::C8, Square::F8]),
+            knights: Bitboard::from_squares(&[Square::B8, Square::G8]),
+            pawns: Bitboard::from_squares(&[
+                Square::A7,
+                Square::B7,
+                Square::C7,
+                Square::D7,
+                Square::E7,
+                Square::F7,
+                Square::G7,
+                Square::H7,
+            ]),
+        }
+    }
+
+    pub(super) fn all(&self) -> Bitboard {
+        self.king | self.queens | self.rooks | self.bishops | self.knights | self.pawns
+    }
+
+    pub(super) fn bitboard_for(&mut self, piece: PieceKind) -> &mut Bitboard {
+        match piece {
+            PieceKind::King => &mut self.king,
+            PieceKind::Queen => &mut self.queens,
+            PieceKind::Rook => &mut self.rooks,
+            PieceKind::Bishop => &mut self.bishops,
+            PieceKind::Knight => &mut self.knights,
+            PieceKind::Pawn => &mut self.pawns,
+        }
+    }
+
+    // TODO: Maybe completely disallow this? If we have the Square ->
+    // Option<Piece> mapping, this is potentially obsolete.
+    pub(super) fn at(&self, square: Square) -> Option<PieceKind> {
+        if self.all().contains(square) {
+            let mut kind = if self.king.contains(square) {
+                PieceKind::King
+            } else {
+                PieceKind::Pawn
+            };
+            if self.king.contains(square) {
+                kind = PieceKind::King;
+            }
+            if self.queens.contains(square) {
+                kind = PieceKind::Queen;
+            }
+            if self.rooks.contains(square) {
+                kind = PieceKind::Rook;
+            }
+            if self.bishops.contains(square) {
+                kind = PieceKind::Bishop;
+            }
+            if self.knights.contains(square) {
+                kind = PieceKind::Knight;
+            }
+            return Some(kind);
+        }
+        None
+    }
+
+    pub(super) fn clear(&mut self, square: Square) {
+        self.king.clear(square);
+        self.queens.clear(square);
+        self.rooks.clear(square);
+        self.bishops.clear(square);
+        self.knights.clear(square);
+        self.pawns.clear(square);
+    }
+}
+
+/// Piece-centric implementation of the chess board. This is the "back-end" of
+/// the chess engine, an efficient board representation is crucial for
+/// performance. An alternative implementation would be Square-Piece table but
+/// both have different trade-offs and scenarios where they are efficient. It is
+/// likely that the best overall performance can be achieved by keeping both to
+/// complement each other.
+#[derive(Clone, PartialEq, Eq)]
+pub(super) struct Board {
+    pub(super) white_pieces: Pieces,
+    pub(super) black_pieces: Pieces,
+}
+
+impl Board {
+    #[must_use]
+    pub(super) fn starting() -> Self {
+        Self {
+            white_pieces: Pieces::new_white(),
+            black_pieces: Pieces::new_black(),
+        }
+    }
+
+    // Constructs an empty Board to be filled by the board and position builder.
+    #[must_use]
+    pub(super) fn empty() -> Self {
+        Self {
+            white_pieces: Pieces::empty(),
+            black_pieces: Pieces::empty(),
+        }
+    }
+
+    #[must_use]
+    pub(super) fn player_pieces(&self, player: Player) -> &Pieces {
+        match player {
+            Player::White => &self.white_pieces,
+            Player::Black => &self.black_pieces,
+        }
+    }
+
+    // WARNING: This is slow and inefficient for Bitboard-based piece-centric
+    // representation. Use with caution.
+    // TODO: Completely disallow bitboard.at()?
+    #[must_use]
+    pub(super) fn at(&self, square: Square) -> Option<Piece> {
+        if let Some(kind) = self.white_pieces.at(square) {
+            return Some(Piece {
+                owner: Player::White,
+                kind,
+            });
+        }
+        if let Some(kind) = self.black_pieces.at(square) {
+            return Some(Piece {
+                owner: Player::Black,
+                kind,
+            });
+        }
+        None
+    }
+}
+
+impl fmt::Display for Board {
+    /// Prints board representation in FEN format.
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        for rank in Rank::iter().rev() {
+            let mut empty_squares = 0i32;
+            for file in File::iter() {
+                let square = Square::new(file, rank);
+                if let Some(piece) = self.at(square) {
+                    if empty_squares != 0 {
+                        write!(f, "{empty_squares}")?;
+                        empty_squares = 0;
+                    }
+                    write!(f, "{}", piece)?;
+                } else {
+                    empty_squares += 1;
+                }
+            }
+            if empty_squares != 0 {
+                write!(f, "{empty_squares}")?;
+            }
+            if rank != Rank::One {
+                const RANK_SEPARATOR: char = '/';
+                write!(f, "{RANK_SEPARATOR}")?;
+            }
+        }
+        Ok(())
+    }
+}
+
+impl fmt::Debug for Board {
+    /// Dumps the board in a simple format ('.' for empty square, FEN algebraic
+    /// symbol for piece) a-la Stockfish "debug" command in UCI mode.
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        for rank in Rank::iter().rev() {
+            for file in File::iter() {
+                match self.at(Square::new(file, rank)) {
+                    Some(piece) => write!(f, "{piece}"),
+                    None => f.write_char('.'),
+                }?;
+                if file != File::H {
+                    write!(f, "{}", SQUARE_SEPARATOR)?;
+                }
+            }
+            if rank != Rank::One {
+                write!(f, "{}", LINE_SEPARATOR)?;
+            }
+        }
+        Ok(())
+    }
+}
+
+const LINE_SEPARATOR: &str = "\n";
+const SQUARE_SEPARATOR: &str = " ";
+
+#[cfg(test)]
+mod test {
+    use pretty_assertions::assert_eq;
+
+    use super::*;
+    use crate::chess::core::{Rank, Square, BOARD_WIDTH};
+
+    #[test]
+    fn basics() {
+        assert_eq!(std::mem::size_of::<Bitboard>(), 8);
+        assert_eq!(Bitboard::full().bits, u64::MAX);
+        assert_eq!(Bitboard::empty().bits, u64::MIN);
+
+        assert_eq!(Bitboard::from(Square::A1).bits, 1);
+        assert_eq!(Bitboard::from(Square::B1).bits, 2);
+        assert_eq!(Bitboard::from(Square::D1).bits, 8);
+        assert_eq!(Bitboard::from(Square::H8).bits, 1u64 << 63);
+
+        assert_eq!(
+            Bitboard::from(Square::D1) | Bitboard::from(Square::B1),
+            Bitboard::from_bits(0b10 | 0b1000)
+        );
+    }
+
+    #[test]
+    fn set_basics() {
+        // Create a starting position.
+        let white = Pieces::new_white();
+        let black = Pieces::new_black();
+
+        // Check that each player has 16 pieces.
+        assert_eq!(white.all().bits.count_ones(), 16);
+        assert_eq!(black.all().bits.count_ones(), 16);
+        // Check that each player has correct number of pieces (previous check
+        // was not enough to confirm there are no overlaps).
+        assert_eq!(white.king.bits.count_ones(), 1);
+        assert_eq!(black.king.bits.count_ones(), 1);
+        assert_eq!(white.queens.bits.count_ones(), 1);
+        assert_eq!(black.queens.bits.count_ones(), 1);
+        assert_eq!(white.rooks.bits.count_ones(), 2);
+        assert_eq!(black.rooks.bits.count_ones(), 2);
+        assert_eq!(white.bishops.bits.count_ones(), 2);
+        assert_eq!(black.bishops.bits.count_ones(), 2);
+        assert_eq!(white.knights.bits.count_ones(), 2);
+        assert_eq!(black.knights.bits.count_ones(), 2);
+        assert_eq!(white.pawns.bits.count_ones(), 8);
+        assert_eq!(black.pawns.bits.count_ones(), 8);
+
+        // Check few positions manually.
+        assert_eq!(white.queens.bits, 1 << 3);
+        assert_eq!(black.queens.bits, 1 << (3 + 8 * 7));
+
+        // Rank masks.
+        assert_eq!(Rank::One.mask() << u32::from(BOARD_WIDTH), Rank::Two.mask());
+        assert_eq!(
+            Rank::Five.mask() >> u32::from(BOARD_WIDTH),
+            Rank::Four.mask()
+        );
+    }
+
+    #[test]
+    fn bitboard_iterator() {
+        let white = Pieces::new_white();
+
+        let mut it = white.king.iter();
+        assert_eq!(it.next(), Some(Square::E1));
+        assert_eq!(it.next(), None);
+
+        let mut it = white.bishops.iter();
+        assert_eq!(it.next(), Some(Square::C1));
+        assert_eq!(it.next(), Some(Square::F1));
+        assert_eq!(it.next(), None);
+
+        // The order is important here: we are iterating from least significant
+        // bits to most significant bits.
+        assert_eq!(
+            white.pawns.iter().collect::<Vec<_>>(),
+            vec![
+                Square::A2,
+                Square::B2,
+                Square::C2,
+                Square::D2,
+                Square::E2,
+                Square::F2,
+                Square::G2,
+                Square::H2,
+            ]
+        );
+    }
+
+    #[test]
+    fn set_ops() {
+        let bitboard = Bitboard::from_squares(&[
+            Square::A1,
+            Square::B1,
+            Square::C1,
+            Square::D1,
+            Square::E1,
+            Square::F1,
+            Square::H1,
+            Square::A2,
+            Square::B2,
+            Square::C2,
+            Square::D2,
+            Square::G2,
+            Square::F2,
+            Square::H2,
+            Square::F3,
+            Square::E4,
+            Square::E5,
+            Square::C6,
+            Square::A7,
+            Square::B7,
+            Square::C7,
+            Square::D7,
+            Square::F7,
+            Square::G7,
+            Square::H7,
+            Square::A8,
+            Square::C8,
+            Square::D8,
+            Square::E8,
+            Square::F8,
+            Square::G8,
+            Square::H8,
+        ]);
+        assert_eq!(
+            format!("{:?}", bitboard),
+            "1 . 1 1 1 1 1 1\n\
+            1 1 1 1 . 1 1 1\n\
+            . . 1 . . . . .\n\
+            . . . . 1 . . .\n\
+            . . . . 1 . . .\n\
+            . . . . . 1 . .\n\
+            1 1 1 1 . 1 1 1\n\
+            1 1 1 1 1 1 . 1"
+        );
+        assert_eq!(
+            format!("{:?}", !bitboard),
+            ". 1 . . . . . .\n\
+            . . . . 1 . . .\n\
+            1 1 . 1 1 1 1 1\n\
+            1 1 1 1 . 1 1 1\n\
+            1 1 1 1 . 1 1 1\n\
+            1 1 1 1 1 . 1 1\n\
+            . . . . 1 . . .\n\
+            . . . . . . 1 ."
+        );
+        assert_eq!(
+            format!(
+                "{:?}",
+                bitboard - Bitboard::from_squares(&[Square::A1, Square::E4, Square::G8])
+            ),
+            "1 . 1 1 1 1 . 1\n\
+            1 1 1 1 . 1 1 1\n\
+            . . 1 . . . . .\n\
+            . . . . 1 . . .\n\
+            . . . . . . . .\n\
+            . . . . . 1 . .\n\
+            1 1 1 1 . 1 1 1\n\
+            . 1 1 1 1 1 . 1"
+        );
+        assert_eq!(!!bitboard, bitboard);
+        assert_eq!(bitboard - !bitboard, bitboard);
+    }
+
+    #[test]
+    // Check the debug output for few bitboards.
+    fn bitboard_dump() {
+        assert_eq!(
+            format!("{:?}", Bitboard::empty()),
+            ". . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", Bitboard::full()),
+            "1 1 1 1 1 1 1 1\n\
+             1 1 1 1 1 1 1 1\n\
+             1 1 1 1 1 1 1 1\n\
+             1 1 1 1 1 1 1 1\n\
+             1 1 1 1 1 1 1 1\n\
+             1 1 1 1 1 1 1 1\n\
+             1 1 1 1 1 1 1 1\n\
+             1 1 1 1 1 1 1 1"
+        );
+        assert_eq!(
+            format!(
+                "{:?}",
+                Bitboard::from(Square::G5) | Bitboard::from(Square::B8)
+            ),
+            ". 1 . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . 1 .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . ."
+        );
+    }
+
+    #[test]
+    fn set_dump() {
+        let white = Pieces::new_white();
+        let black = Pieces::new_black();
+
+        assert_eq!(
+            format!("{:?}", black.all()),
+            "1 1 1 1 1 1 1 1\n\
+             1 1 1 1 1 1 1 1\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", white.all() | black.all()),
+            "1 1 1 1 1 1 1 1\n\
+             1 1 1 1 1 1 1 1\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             1 1 1 1 1 1 1 1\n\
+             1 1 1 1 1 1 1 1"
+        );
+
+        assert_eq!(
+            format!("{:?}", white.king),
+            ". . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . 1 . . ."
+        );
+        assert_eq!(
+            format!("{:?}", black.pawns),
+            ". . . . . . . .\n\
+             1 1 1 1 1 1 1 1\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . ."
+        );
+        assert_eq!(
+            format!("{:?}", black.knights),
+            ". 1 . . . . 1 .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . ."
+        );
+    }
+
+    #[test]
+    fn starting_board() {
+        let starting_board = Board::starting();
+        assert_eq!(
+            format!("{:?}", starting_board),
+            "r n b q k b n r\n\
+             p p p p p p p p\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             P P P P P P P P\n\
+             R N B Q K B N R"
+        );
+        assert_eq!(
+            starting_board.white_pieces.all() | starting_board.black_pieces.all(),
+            Rank::One.mask() | Rank::Two.mask() | Rank::Seven.mask() | Rank::Eight.mask()
+        );
+        assert_eq!(
+            !(starting_board.white_pieces.all() | starting_board.black_pieces.all()),
+            Rank::Three.mask() | Rank::Four.mask() | Rank::Five.mask() | Rank::Six.mask()
+        );
+        assert_eq!(
+            starting_board.to_string(),
+            "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR"
+        );
+    }
+
+    #[test]
+    fn empty_board() {
+        assert_eq!(
+            format!("{:?}", Board::empty()),
+            ". . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . .\n\
+             . . . . . . . ."
+        );
+        assert_eq!(Board::empty().to_string(), "8/8/8/8/8/8/8/8");
+    }
+}
+
\ No newline at end of file diff --git a/docs/src/pabi/chess/core.rs.html b/docs/src/pabi/chess/core.rs.html new file mode 100644 index 00000000..972f5787 --- /dev/null +++ b/docs/src/pabi/chess/core.rs.html @@ -0,0 +1,1685 @@ +core.rs - source +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+
//! Chess primitives commonly used within [`crate::chess`].
+
+use std::fmt::{self, Write};
+use std::mem;
+
+use anyhow::bail;
+use itertools::Itertools;
+
+use crate::chess::bitboard::Bitboard;
+use crate::chess::position::Position;
+
+#[allow(missing_docs)]
+pub const BOARD_WIDTH: u8 = 8;
+#[allow(missing_docs)]
+pub const BOARD_SIZE: u8 = BOARD_WIDTH * BOARD_WIDTH;
+
+/// Represents any kind of a legal chess move. A move is the only way to mutate
+/// [`crate::chess::position::Position`] and change the board state. Moves are
+/// not sorted according to their potential "value" by the move generator. The
+/// move representation has one-to-one correspondence with the UCI move
+/// representation. The moves can also be indexed and fed as an input to the
+/// Neural Network evaluators that would be able assess their potential without
+/// evaluating post-states.
+///
+/// For a move to be serialized in Standard Algebraic Notation (SAN), it also
+/// also requires the [`crate::chess::position::Position`] it will be applied
+/// in, because SAN requires additional flags (e.g. indicating
+/// "check"/"checkmate" or moving piece disambiguation).
+// TODO: Implement bijection for a move and a numeric index.
+// TODO: Switch this to an enum representation (regular, en passant, castling).
+#[derive(Copy, Clone, Debug)]
+pub struct Move {
+    pub(super) from: Square,
+    pub(super) to: Square,
+    pub(super) promotion: Option<Promotion>,
+}
+
+impl Move {
+    #[must_use]
+    pub const fn new(from: Square, to: Square, promotion: Option<Promotion>) -> Self {
+        Self {
+            from,
+            to,
+            promotion,
+        }
+    }
+
+    #[must_use]
+    pub fn from_san(_position: &Position) -> Self {
+        todo!()
+    }
+}
+
+impl fmt::Display for Move {
+    /// Serializes a move in [UCI format].
+    ///
+    /// [UCI format]: http://wbec-ridderkerk.nl/html/UCIProtocol.html
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(f, "{}{}", self.from, self.to)?;
+        if let Some(promotion) = self.promotion {
+            write!(f, "{}", PieceKind::from(promotion))?;
+        }
+        Ok(())
+    }
+}
+
+/// Size of [`MoveList`] and an upper bound of moves in a chess position (which
+/// [seems to be 218](https://www.chessprogramming.org/Chess_Position). 256 provides the best
+/// performance through optimal memory alignment.
+const MAX_MOVES: usize = 256;
+
+/// Moves are stored on stack to avoid memory allocations. This is important for
+/// performance reasons and also prevents unnecessary copying that would occur
+/// if the moves would be stored in `std::Vec` with unknown capacity.
+pub type MoveList = arrayvec::ArrayVec<Move, { MAX_MOVES }>;
+
+/// Board squares: from left to right, from bottom to the top ([Little-Endian Rank-File Mapping]):
+///
+/// ```
+/// use pabi::chess::core::Square;
+///
+/// assert_eq!(Square::A1 as u8, 0);
+/// assert_eq!(Square::E1 as u8, 4);
+/// assert_eq!(Square::H1 as u8, 7);
+/// assert_eq!(Square::A4 as u8, 8 * 3);
+/// assert_eq!(Square::H8 as u8, 63);
+/// ```
+///
+/// Square is a compact representation using only one byte.
+///
+/// ```
+/// use pabi::chess::core::Square;
+/// use std::mem;
+///
+/// assert_eq!(std::mem::size_of::<Square>(), 1);
+/// ```
+///
+/// [Little-Endian Rank-File Mapping]: https://www.chessprogramming.org/Square_Mapping_Considerations#LittleEndianRankFileMapping
+#[repr(u8)]
+#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, strum::EnumIter)]
+#[rustfmt::skip]
+#[allow(missing_docs)]
+pub enum Square {
+    A1 = 0, B1, C1, D1, E1, F1, G1, H1,
+    A2, B2, C2, D2, E2, F2, G2, H2,
+    A3, B3, C3, D3, E3, F3, G3, H3,
+    A4, B4, C4, D4, E4, F4, G4, H4,
+    A5, B5, C5, D5, E5, F5, G5, H5,
+    A6, B6, C6, D6, E6, F6, G6, H6,
+    A7, B7, C7, D7, E7, F7, G7, H7,
+    A8, B8, C8, D8, E8, F8, G8, H8,
+}
+
+impl Square {
+    /// Connects file (column) and rank (row) to form a full square.
+    #[must_use]
+    pub const fn new(file: File, rank: Rank) -> Self {
+        unsafe { mem::transmute(file as u8 + (rank as u8) * BOARD_WIDTH) }
+    }
+
+    /// Returns file (column) on which the square is located.
+    #[must_use]
+    pub const fn file(self) -> File {
+        unsafe { mem::transmute(self as u8 % BOARD_WIDTH) }
+    }
+
+    /// Returns rank (row) on which the square is located.
+    #[must_use]
+    pub const fn rank(self) -> Rank {
+        unsafe { mem::transmute(self as u8 / BOARD_WIDTH) }
+    }
+
+    #[must_use]
+    pub fn shift(self, direction: Direction) -> Option<Self> {
+        let shift: i8 = match direction {
+            Direction::Up => BOARD_WIDTH as i8,
+            Direction::Down => -(BOARD_WIDTH as i8),
+        };
+        // TODO: Should this be TryFrom<i8> instead?
+        let candidate = self as i8 + shift;
+        if candidate < 0 {
+            return None;
+        }
+        match Self::try_from(candidate as u8) {
+            Ok(square) => Some(square),
+            Err(_) => None,
+        }
+    }
+}
+
+impl TryFrom<u8> for Square {
+    type Error = anyhow::Error;
+
+    /// Creates a square given its position on the board.
+    ///
+    /// # Errors
+    ///
+    /// If given square index is outside 0..[`BOARD_SIZE`] range.
+    fn try_from(square_index: u8) -> anyhow::Result<Self> {
+        // Exclusive range patterns are not allowed:
+        // https://github.com/rust-lang/rust/issues/37854
+        const MAX_INDEX: u8 = BOARD_SIZE - 1;
+        match square_index {
+            0..=MAX_INDEX => Ok(unsafe { mem::transmute(square_index) }),
+            _ => bail!("square index should be in 0..BOARD_SIZE, got {square_index}"),
+        }
+    }
+}
+
+impl TryFrom<&str> for Square {
+    type Error = anyhow::Error;
+
+    fn try_from(square: &str) -> anyhow::Result<Self> {
+        let (file, rank) = match square.chars().collect_tuple() {
+            Some((file, rank)) => (file, rank),
+            None => bail!(
+                "square should be two-char, got {square} with {} chars",
+                square.bytes().len()
+            ),
+        };
+        Ok(Self::new(file.try_into()?, rank.try_into()?))
+    }
+}
+
+impl fmt::Display for Square {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(f, "{}{}", self.file(), self.rank())
+    }
+}
+
+/// Represents a column (vertical row) of the chessboard. In chess notation, it
+/// is normally represented with a lowercase letter.
+// TODO: Re-export in lib.rs for convenience?
+#[repr(u8)]
+#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, strum::EnumIter)]
+#[allow(missing_docs)]
+pub enum File {
+    A = 0,
+    B = 1,
+    C = 2,
+    D = 3,
+    E = 4,
+    F = 5,
+    G = 6,
+    H = 7,
+}
+
+impl File {
+    /// Returns a pre-calculated bitboard mask with 1s set for squares of the
+    /// given file.
+    pub(super) fn mask(self) -> Bitboard {
+        match self {
+            File::A => Bitboard::from_bits(0x101010101010101),
+            File::B => Bitboard::from_bits(0x202020202020202),
+            File::C => Bitboard::from_bits(0x404040404040404),
+            File::D => Bitboard::from_bits(0x808080808080808),
+            File::E => Bitboard::from_bits(0x1010101010101010),
+            File::F => Bitboard::from_bits(0x2020202020202020),
+            File::G => Bitboard::from_bits(0x4040404040404040),
+            File::H => Bitboard::from_bits(0x8080808080808080),
+        }
+    }
+}
+
+impl fmt::Display for File {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(f, "{}", (b'a' + *self as u8) as char)
+    }
+}
+
+// TODO: Here and in Rank: implement From<u8> and see whether/how much faster it
+// is than the safe checked version.
+impl TryFrom<char> for File {
+    type Error = anyhow::Error;
+
+    fn try_from(file: char) -> anyhow::Result<Self> {
+        match file {
+            'a'..='h' => Ok(unsafe { mem::transmute(file as u8 - b'a') }),
+            _ => bail!("file should be within 'a'..='h', got '{file}'"),
+        }
+    }
+}
+
+impl TryFrom<u8> for File {
+    type Error = anyhow::Error;
+
+    fn try_from(column: u8) -> anyhow::Result<Self> {
+        match column {
+            0..=7 => Ok(unsafe { mem::transmute(column) }),
+            _ => bail!("file should be within 0..BOARD_WIDTH, got {column}"),
+        }
+    }
+}
+
+/// Represents a horizontal row of the chessboard. In chess notation, it is
+/// represented with a number. The implementation assumes zero-based values
+/// (i.e. rank 1 would be 0).
+// TODO: Check if implementing iterators manually (instead of using strum) would
+// be faster.
+#[repr(u8)]
+#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, strum::EnumIter)]
+#[allow(missing_docs)]
+pub enum Rank {
+    One = 0,
+    Two = 1,
+    Three = 2,
+    Four = 3,
+    Five = 4,
+    Six = 5,
+    Seven = 6,
+    Eight = 7,
+}
+
+impl Rank {
+    /// Returns a pre-calculated bitboard mask with 1s set for squares of the
+    /// given rank.
+    pub(super) fn mask(self) -> Bitboard {
+        match self {
+            Rank::One => Bitboard::from_bits(0x0000_0000_0000_00FF),
+            Rank::Two => Bitboard::from_bits(0x0000_0000_0000_FF00),
+            Rank::Three => Bitboard::from_bits(0x0000_0000_00FF_0000),
+            Rank::Four => Bitboard::from_bits(0x0000_0000_FF00_0000),
+            Rank::Five => Bitboard::from_bits(0x0000_00FF_0000_0000),
+            Rank::Six => Bitboard::from_bits(0x0000_FF00_0000_0000),
+            Rank::Seven => Bitboard::from_bits(0x00FF_0000_0000_0000),
+            Rank::Eight => Bitboard::from_bits(0xFF00_0000_0000_0000),
+        }
+    }
+
+    pub(super) fn backrank(player: Player) -> Self {
+        match player {
+            Player::White => Self::One,
+            Player::Black => Self::Eight,
+        }
+    }
+
+    pub(super) fn pawns_starting(player: Player) -> Self {
+        match player {
+            Player::White => Self::Two,
+            Player::Black => Self::Seven,
+        }
+    }
+}
+
+impl TryFrom<char> for Rank {
+    type Error = anyhow::Error;
+
+    fn try_from(rank: char) -> anyhow::Result<Self> {
+        match rank {
+            '1'..='8' => Ok(unsafe { mem::transmute(rank as u8 - b'1') }),
+            _ => bail!("rank should be within '1'..='8', got '{rank}'"),
+        }
+    }
+}
+
+impl TryFrom<u8> for Rank {
+    type Error = anyhow::Error;
+
+    fn try_from(row: u8) -> anyhow::Result<Self> {
+        match row {
+            0..=7 => Ok(unsafe { mem::transmute(row) }),
+            _ => bail!("rank should be within 0..BOARD_WIDTH, got {row}"),
+        }
+    }
+}
+
+impl fmt::Display for Rank {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(f, "{}", *self as u8 + 1)
+    }
+}
+
+/// A standard game of chess is played between two players: White (having the
+/// advantage of the first turn) and Black.
+#[allow(missing_docs)]
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub enum Player {
+    White,
+    Black,
+}
+
+impl Player {
+    /// "Flips" the color.
+    #[must_use]
+    pub fn opponent(self) -> Self {
+        match self {
+            Self::White => Self::Black,
+            Self::Black => Self::White,
+        }
+    }
+
+    pub(super) fn push_direction(self) -> Direction {
+        match self {
+            Self::White => Direction::Up,
+            Self::Black => Direction::Down,
+        }
+    }
+}
+
+impl TryFrom<&str> for Player {
+    type Error = anyhow::Error;
+
+    fn try_from(player: &str) -> anyhow::Result<Self> {
+        match player {
+            "w" => Ok(Self::White),
+            "b" => Ok(Self::Black),
+            _ => bail!("player should be 'w' or 'b', got '{player}'"),
+        }
+    }
+}
+
+impl fmt::Display for Player {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(
+            f,
+            "{}",
+            match &self {
+                Player::White => 'w',
+                Player::Black => 'b',
+            }
+        )
+    }
+}
+
+/// Standard [chess pieces].
+///
+/// [chess pieces]: https://en.wikipedia.org/wiki/Chess_piece
+#[allow(missing_docs)]
+#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
+pub enum PieceKind {
+    King = 1,
+    Queen,
+    Rook,
+    Bishop,
+    Knight,
+    Pawn,
+}
+
+impl From<Promotion> for PieceKind {
+    fn from(promotion: Promotion) -> Self {
+        match promotion {
+            Promotion::Queen => Self::Queen,
+            Promotion::Rook => Self::Rook,
+            Promotion::Bishop => Self::Bishop,
+            Promotion::Knight => Self::Knight,
+        }
+    }
+}
+
+impl fmt::Display for PieceKind {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.write_char(match &self {
+            Self::King => 'k',
+            Self::Queen => 'q',
+            Self::Rook => 'r',
+            Self::Bishop => 'b',
+            Self::Knight => 'n',
+            Self::Pawn => 'p',
+        })
+    }
+}
+
+/// Represents a specific piece owned by a player.
+pub struct Piece {
+    #[allow(missing_docs)]
+    pub owner: Player,
+    #[allow(missing_docs)]
+    pub kind: PieceKind,
+}
+
+impl TryFrom<char> for Piece {
+    type Error = anyhow::Error;
+
+    fn try_from(symbol: char) -> anyhow::Result<Self> {
+        match symbol {
+            'K' => Ok(Self {
+                owner: Player::White,
+                kind: PieceKind::King,
+            }),
+            'Q' => Ok(Self {
+                owner: Player::White,
+                kind: PieceKind::Queen,
+            }),
+            'R' => Ok(Self {
+                owner: Player::White,
+                kind: PieceKind::Rook,
+            }),
+            'B' => Ok(Self {
+                owner: Player::White,
+                kind: PieceKind::Bishop,
+            }),
+            'N' => Ok(Self {
+                owner: Player::White,
+                kind: PieceKind::Knight,
+            }),
+            'P' => Ok(Self {
+                owner: Player::White,
+                kind: PieceKind::Pawn,
+            }),
+            'k' => Ok(Self {
+                owner: Player::Black,
+                kind: PieceKind::King,
+            }),
+            'q' => Ok(Self {
+                owner: Player::Black,
+                kind: PieceKind::Queen,
+            }),
+            'r' => Ok(Self {
+                owner: Player::Black,
+                kind: PieceKind::Rook,
+            }),
+            'b' => Ok(Self {
+                owner: Player::Black,
+                kind: PieceKind::Bishop,
+            }),
+            'n' => Ok(Self {
+                owner: Player::Black,
+                kind: PieceKind::Knight,
+            }),
+            'p' => Ok(Self {
+                owner: Player::Black,
+                kind: PieceKind::Pawn,
+            }),
+            _ => bail!("piece symbol should be within \"KQRBNPkqrbnp\", got '{symbol}'"),
+        }
+    }
+}
+
+impl fmt::Display for Piece {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.write_char(match (&self.owner, &self.kind) {
+            // White player: uppercase symbols.
+            (Player::White, PieceKind::King) => 'K',
+            (Player::White, PieceKind::Queen) => 'Q',
+            (Player::White, PieceKind::Rook) => 'R',
+            (Player::White, PieceKind::Bishop) => 'B',
+            (Player::White, PieceKind::Knight) => 'N',
+            (Player::White, PieceKind::Pawn) => 'P',
+            // Black player: lowercase symbols.
+            (Player::Black, PieceKind::King) => 'k',
+            (Player::Black, PieceKind::Queen) => 'q',
+            (Player::Black, PieceKind::Rook) => 'r',
+            (Player::Black, PieceKind::Bishop) => 'b',
+            (Player::Black, PieceKind::Knight) => 'n',
+            (Player::Black, PieceKind::Pawn) => 'p',
+        })
+    }
+}
+
+bitflags::bitflags! {
+    /// Track the ability to [castle] each side (kingside is often referred to
+    /// as O-O or h-side castle, queenside -- O-O-O or a-side castle). When the
+    /// king moves, player loses ability to castle. When the rook moves, player
+    /// loses ability to castle to the side from which the rook moved.
+    ///
+    /// Castling is relatively straightforward in the Standard Chess but is
+    /// often misunderstood in Fischer Random Chess (also known as FRC or
+    /// Chess960). An easy mnemonic is that the king and the rook end up on the
+    /// same files for both Standard and FRC:
+    ///
+    /// - When castling h-side (short), the king ends up on [`File::G`] and the
+    ///   rook on [`File::F`]
+    /// - When castling a-side (long), the king ends up on [`File::C`] and the
+    ///   rook on [`File::D`]
+    ///
+    /// The full rules are:
+    ///
+    /// - The king and the castling rook must not have previously moved.
+    /// - No square from the king's initial square to its final square may be under
+    ///   attack by an enemy piece.
+    /// - All the squares between the king's initial and final squares
+    ///   (including the final square), and all the squares between the castling
+    ///   rook's initial and final squares (including the final square), must be
+    ///   vacant except for the king and castling rook.
+    ///
+    /// [castle]: https://www.chessprogramming.org/Castling
+    // TODO: Update docs for FCR.
+    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
+    pub struct CastleRights : u8 {
+        #[allow(missing_docs)]
+        const NONE = 0;
+        #[allow(missing_docs)]
+        const WHITE_SHORT = 0b1000;
+        #[allow(missing_docs)]
+        const WHITE_LONG = 0b0100;
+        #[allow(missing_docs)]
+        const WHITE_BOTH = Self::WHITE_SHORT.bits() | Self::WHITE_LONG.bits();
+        #[allow(missing_docs)]
+        const BLACK_SHORT = 0b0010;
+        #[allow(missing_docs)]
+        const BLACK_LONG = 0b0001;
+        #[allow(missing_docs)]
+        const BLACK_BOTH = Self::BLACK_SHORT.bits() | Self::BLACK_LONG.bits();
+        #[allow(missing_docs)]
+        const ALL = Self::WHITE_BOTH.bits() | Self::BLACK_BOTH.bits();
+    }
+}
+
+impl CastleRights {
+    fn mask(player: Player) -> Self {
+        match player {
+            Player::White => Self::WHITE_BOTH,
+            Player::Black => Self::BLACK_BOTH,
+        }
+    }
+}
+
+impl TryFrom<&str> for CastleRights {
+    type Error = anyhow::Error;
+
+    /// Parses [`CastleRights`] for both players from the FEN format. The user
+    /// is responsible for providing valid input cleaned up from the actual FEN
+    /// chunk.
+    ///
+    /// # Errors
+    ///
+    /// Returns [`anyhow::Error`] if given pattern does not match
+    ///
+    /// [`CastleRights`] := (K)? (Q)? (k)? (q)?
+    ///
+    /// Note that both letters have to be either uppercase or lowercase.
+    fn try_from(input: &str) -> anyhow::Result<Self> {
+        // Enumerate all possibilities.
+        match input.as_bytes() {
+            // K Q k q
+            // - - - -
+            // 0 0 0 0
+            b"-" => Ok(Self::NONE),
+            // 0 0 0 1
+            b"q" => Ok(Self::BLACK_LONG),
+            // 0 0 1 0
+            b"k" => Ok(Self::BLACK_SHORT),
+            // 0 0 1 1
+            b"kq" => Ok(Self::BLACK_BOTH),
+            // 0 1 0 0
+            b"Q" => Ok(Self::WHITE_LONG),
+            // 0 1 0 1
+            b"Qq" => Ok(Self::WHITE_LONG | Self::BLACK_LONG),
+            // 0 1 1 0
+            b"Qk" => Ok(Self::WHITE_LONG | Self::BLACK_SHORT),
+            // 0 1 1 1
+            b"Qkq" => Ok(Self::WHITE_LONG | Self::BLACK_BOTH),
+            // 1 0 0 0
+            b"K" => Ok(Self::WHITE_SHORT),
+            // 1 0 0 1
+            b"Kq" => Ok(Self::WHITE_SHORT | Self::BLACK_LONG),
+            // 1 0 1 0
+            b"Kk" => Ok(Self::WHITE_SHORT | Self::BLACK_SHORT),
+            // 1 0 1 1
+            b"Kkq" => Ok(Self::WHITE_SHORT | Self::BLACK_BOTH),
+            // 1 1 0 0
+            b"KQ" => Ok(Self::WHITE_BOTH),
+            // 1 1 0 1
+            b"KQq" => Ok(Self::WHITE_BOTH | Self::BLACK_LONG),
+            // 1 1 1 0
+            b"KQk" => Ok(Self::WHITE_BOTH | Self::BLACK_SHORT),
+            // 1 1 1 1
+            b"KQkq" => Ok(Self::ALL),
+            _ => bail!("unknown castle rights: {input}"),
+        }
+    }
+}
+
+impl fmt::Display for CastleRights {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        if *self == Self::NONE {
+            return f.write_char('-');
+        }
+        if *self & Self::WHITE_SHORT != Self::NONE {
+            f.write_char('K')?;
+        }
+        if *self & Self::WHITE_LONG != Self::NONE {
+            f.write_char('Q')?;
+        }
+        if *self & Self::BLACK_SHORT != Self::NONE {
+            f.write_char('k')?;
+        }
+        if *self & Self::BLACK_LONG != Self::NONE {
+            f.write_char('q')?;
+        }
+        Ok(())
+    }
+}
+
+/// A pawn can be promoted to a queen, rook, bishop or a knight.
+#[allow(missing_docs)]
+#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
+pub enum Promotion {
+    Queen,
+    Rook,
+    Bishop,
+    Knight,
+}
+
+/// Directions on the board from a perspective of White player.
+///
+/// Traditionally those are North (Up), West (Left), East (Right), South (Down)
+/// and their combinations. However, using cardinal directions is confusing,
+/// hence they are replaced by relative directions.
+// TODO: Either use double directions in en passant calculations or only leave Up an Down.
+#[derive(Copy, Clone, Debug, strum::EnumIter)]
+pub enum Direction {
+    /// Also known as North.
+    Up,
+    /// Also known as South.
+    Down,
+}
+
+impl Direction {
+    pub(super) fn opposite(self) -> Self {
+        match self {
+            Self::Up => Self::Down,
+            Self::Down => Self::Up,
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use std::mem::{size_of, size_of_val};
+
+    use pretty_assertions::assert_eq;
+
+    use super::*;
+
+    #[test]
+    fn rank() {
+        assert_eq!(
+            ('1'..='9')
+                .filter_map(|ch| Rank::try_from(ch).ok())
+                .collect::<Vec<Rank>>(),
+            vec![
+                Rank::One,
+                Rank::Two,
+                Rank::Three,
+                Rank::Four,
+                Rank::Five,
+                Rank::Six,
+                Rank::Seven,
+                Rank::Eight,
+            ]
+        );
+        assert_eq!(
+            ('1'..='9')
+                .filter_map(|idx| Rank::try_from(idx).ok())
+                .collect::<Vec<Rank>>(),
+            vec![
+                Rank::One,
+                Rank::Two,
+                Rank::Three,
+                Rank::Four,
+                Rank::Five,
+                Rank::Six,
+                Rank::Seven,
+                Rank::Eight,
+            ]
+        );
+    }
+
+    #[test]
+    #[should_panic(expected = "rank should be within '1'..='8', got '9'")]
+    fn rank_from_incorrect_char() {
+        let _ = Rank::try_from('9').unwrap();
+    }
+
+    #[test]
+    #[should_panic(expected = "rank should be within '1'..='8', got '0'")]
+    fn rank_from_incorrect_char_zero() {
+        let _ = Rank::try_from('0').unwrap();
+    }
+
+    #[test]
+    #[should_panic(expected = "rank should be within 0..BOARD_WIDTH, got 8")]
+    fn rank_from_incorrect_index() {
+        let _ = Rank::try_from(BOARD_WIDTH).unwrap();
+    }
+
+    #[test]
+    fn file() {
+        assert_eq!(
+            ('a'..='i')
+                .filter_map(|ch| File::try_from(ch).ok())
+                .collect::<Vec<File>>(),
+            vec![
+                File::A,
+                File::B,
+                File::C,
+                File::D,
+                File::E,
+                File::F,
+                File::G,
+                File::H,
+            ]
+        );
+        assert_eq!(
+            (0..=BOARD_WIDTH)
+                .filter_map(|idx| File::try_from(idx).ok())
+                .collect::<Vec<File>>(),
+            vec![
+                File::A,
+                File::B,
+                File::C,
+                File::D,
+                File::E,
+                File::F,
+                File::G,
+                File::H,
+            ]
+        );
+    }
+
+    #[test]
+    #[should_panic(expected = "file should be within 'a'..='h', got 'i'")]
+    fn file_from_incorrect_char() {
+        let _ = File::try_from('i').unwrap();
+    }
+
+    #[test]
+    #[should_panic(expected = "file should be within 0..BOARD_WIDTH, got 8")]
+    fn file_from_incorrect_index() {
+        let _ = File::try_from(BOARD_WIDTH).unwrap();
+    }
+
+    #[test]
+    fn square() {
+        let squares: Vec<_> = [
+            0u8,
+            BOARD_SIZE - 1,
+            BOARD_WIDTH - 1,
+            BOARD_WIDTH,
+            BOARD_WIDTH * 2 + 5,
+            BOARD_SIZE,
+        ]
+        .iter()
+        .filter_map(|square| Square::try_from(*square).ok())
+        .collect();
+        assert_eq!(
+            squares,
+            vec![Square::A1, Square::H8, Square::H1, Square::A2, Square::F3,]
+        );
+        let squares: Vec<_> = [
+            (File::B, Rank::Three),
+            (File::F, Rank::Five),
+            (File::H, Rank::Eight),
+            (File::E, Rank::Four),
+        ]
+        .iter()
+        .map(|(file, rank)| Square::new(*file, *rank))
+        .collect();
+        assert_eq!(
+            squares,
+            vec![Square::B3, Square::F5, Square::H8, Square::E4]
+        );
+    }
+
+    #[test]
+    #[should_panic(expected = "square index should be in 0..BOARD_SIZE, got 64")]
+    fn square_from_incorrect_index() {
+        let _ = Square::try_from(BOARD_SIZE).unwrap();
+    }
+
+    #[test]
+    fn primitive_size() {
+        assert_eq!(size_of::<Square>(), 1);
+        // Primitives will have small size thanks to the niche optimizations:
+        // https://rust-lang.github.io/unsafe-code-guidelines/layout/enums.html#layout-of-a-data-carrying-enums-without-a-repr-annotation
+        assert_eq!(size_of::<PieceKind>(), size_of::<Option<PieceKind>>());
+        // This is going to be very useful for square-centric board implementation.
+        let square_to_pieces: [Option<PieceKind>; BOARD_SIZE as usize] =
+            [None; BOARD_SIZE as usize];
+        assert_eq!(size_of_val(&square_to_pieces), BOARD_SIZE as usize);
+    }
+
+    #[test]
+    fn square_shift() {
+        assert_eq!(Square::A2.shift(Direction::Up), Some(Square::A3));
+        assert_eq!(Square::B5.shift(Direction::Down), Some(Square::B4));
+        assert_eq!(Square::C1.shift(Direction::Down), None);
+        assert_eq!(Square::G8.shift(Direction::Up), None);
+    }
+}
+
\ No newline at end of file diff --git a/docs/src/pabi/chess/position.rs.html b/docs/src/pabi/chess/position.rs.html new file mode 100644 index 00000000..b1290288 --- /dev/null +++ b/docs/src/pabi/chess/position.rs.html @@ -0,0 +1,1925 @@ +position.rs - source +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+850
+851
+852
+853
+854
+855
+856
+857
+858
+859
+860
+861
+862
+863
+864
+865
+866
+867
+868
+869
+870
+871
+872
+873
+874
+875
+876
+877
+878
+879
+880
+881
+882
+883
+884
+885
+886
+887
+888
+889
+890
+891
+892
+893
+894
+895
+896
+897
+898
+899
+900
+901
+902
+903
+904
+905
+906
+907
+908
+909
+910
+911
+912
+913
+914
+915
+916
+917
+918
+919
+920
+921
+922
+923
+924
+925
+926
+927
+928
+929
+930
+931
+932
+933
+934
+935
+936
+937
+938
+939
+940
+941
+942
+943
+944
+945
+946
+947
+948
+949
+950
+951
+952
+953
+954
+955
+956
+957
+958
+959
+960
+961
+
//! Provides fully-specified [Chess Position] implementation: stores
+//! information about the board and tracks the state of castling, 50-move rule
+//! draw, etc.
+//!
+//! The core of Move Generator and move making is also implemented here as a way
+//! to produce ways of mutating [`Position`].
+//!
+//! [Chess Position]: https://www.chessprogramming.org/Chess_Position
+
+use std::fmt;
+
+use anyhow::{bail, Context};
+
+use crate::chess::attacks;
+use crate::chess::bitboard::{Bitboard, Board, Pieces};
+use crate::chess::core::{
+    CastleRights,
+    File,
+    Move,
+    MoveList,
+    Piece,
+    Player,
+    Promotion,
+    Rank,
+    Square,
+    BOARD_WIDTH,
+};
+
+/// State of the chess game: board, half-move counters and castling rights,
+/// etc. It has 1:1 relationship with [Forsyth-Edwards Notation] (FEN).
+///
+/// [`Position::try_from()`] provides a convenient interface for creating a
+/// [`Position`]. It will clean up the input (trim newlines and whitespace) and
+/// attempt to parse in either FEN or a version of [Extended Position
+/// Description] (EPD). The EPD format Pabi accepts does not support
+/// [Operations]: even though it is an important part of EPD, in practice it is
+/// rarely needed. The EPD support exists for compatibility with some databases
+/// which provide trimmed FEN lines (all FEN parts except Halfmove Clock and
+/// Fullmove Counter). Parsing these positions is important to utilize that
+/// data.
+///
+/// [Forsyth-Edwards Notation]: https://www.chessprogramming.org/Forsyth-Edwards_Notation
+/// [Extended Position Description]: https://www.chessprogramming.org/Extended_Position_Description
+/// [Operations]: https://www.chessprogramming.org/Extended_Position_Description#Operations
+// TODO: Make the fields private, expose appropriate assessors.
+// TODO: Store Zobrist hash, possibly other info.
+#[derive(Clone)]
+pub struct Position {
+    board: Board,
+    castling: CastleRights,
+    side_to_move: Player,
+    /// [Halfmove Clock][^ply] keeps track of the number of (half-)moves
+    /// since the last capture or pawn move and is used to enforce
+    /// fifty[^fifty]-move draw rule.
+    ///
+    ///
+    /// [Halfmove Clock]: https://www.chessprogramming.org/Halfmove_Clock
+    /// [^ply]: "Half-move" or ["ply"](https://www.chessprogramming.org/Ply) means a move of only
+    ///     one side.
+    /// [^fifty]: 50 __full__ moves
+    halfmove_clock: u8,
+    fullmove_counter: u16,
+    en_passant_square: Option<Square>,
+}
+
+impl Position {
+    /// Creates the starting position of the standard chess.
+    ///
+    /// ```
+    /// use pabi::chess::position::Position;
+    ///
+    /// let starting_position = Position::starting();
+    /// assert_eq!(
+    ///     &starting_position.to_string(),
+    ///     "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
+    /// );
+    /// ```
+    #[must_use]
+    pub fn starting() -> Self {
+        Self {
+            board: Board::starting(),
+            castling: CastleRights::ALL,
+            ..Self::empty()
+        }
+    }
+
+    fn empty() -> Self {
+        Self {
+            board: Board::empty(),
+            castling: CastleRights::NONE,
+            side_to_move: Player::White,
+            halfmove_clock: 0,
+            fullmove_counter: 1,
+            en_passant_square: None,
+        }
+    }
+
+    pub(super) fn us(&self) -> Player {
+        self.side_to_move
+    }
+
+    pub(super) fn they(&self) -> Player {
+        self.us().opponent()
+    }
+
+    pub(super) fn pieces(&self, player: Player) -> &Pieces {
+        self.board.player_pieces(player)
+    }
+
+    fn occupancy(&self, player: Player) -> Bitboard {
+        self.board.player_pieces(player).all()
+    }
+
+    fn occupied_squares(&self) -> Bitboard {
+        self.occupancy(self.us()) | self.occupancy(self.they())
+    }
+
+    /// Parses board from Forsyth-Edwards Notation and checks its correctness.
+    /// The parser will accept trimmed full FEN and trimmed FEN (4 first parts).
+    ///
+    /// FEN ::=
+    ///       Piece Placement
+    ///   ' ' Side to move
+    ///   ' ' Castling ability
+    ///   ' ' En passant target square
+    ///   ' ' Halfmove clock
+    ///   ' ' Fullmove counter
+    ///
+    /// The last two parts (together) are optional and will default to "0 1".
+    /// Technically, that is not a full FEN position, but it is supported
+    /// because EPD-style position strings are common in public position books
+    /// and datasets where halfmove clock and fullmove counters do not matter.
+    /// Supporting these datasets is important but distinguishing between full
+    /// and trimmed FEN strings is not.
+    ///
+    /// Correctness check employs a small set of simple heuristics to check if
+    /// the position can be analyzed by the engine and will reject the most
+    /// obvious incorrect positions (e.g. missing kings, pawns on the wrong
+    /// ranks, problems with en passant square). The only public way of creating
+    /// a [`Position`] is by parsing it from string, so this acts as a filter
+    /// for positions that won't cause undefined behavior or crashes. It's
+    /// important that positions that are known to be dubious are filtered out.
+    ///
+    /// NOTE: This expects properly-formatted inputs: no extra symbols or
+    /// additional whitespace. Use [`Position::try_from`] for cleaning up the
+    /// input if it is coming from untrusted source and is likely to contain
+    /// extra symbols.
+    // was not legal.
+    pub fn from_fen(input: &str) -> anyhow::Result<Self> {
+        let mut parts = input.split(' ');
+        // Parse Piece Placement.
+        let mut result = Self::empty();
+        let pieces_placement = match parts.next() {
+            Some(placement) => placement,
+            None => bail!("incorrect FEN: missing pieces placement"),
+        };
+        let ranks = pieces_placement.split('/');
+        let mut rank_id = 8;
+        for rank_fen in ranks {
+            if rank_id == 0 {
+                bail!("incorrect FEN: expected 8 ranks, got {pieces_placement}");
+            }
+            rank_id -= 1;
+            let rank = Rank::try_from(rank_id)?;
+            let mut file: u8 = 0;
+            for symbol in rank_fen.chars() {
+                if file > BOARD_WIDTH {
+                    bail!("file exceeded {BOARD_WIDTH}");
+                }
+                match symbol {
+                    '0' => bail!("increment can not be 0"),
+                    '1'..='9' => {
+                        file += symbol as u8 - b'0';
+                        continue;
+                    },
+                    _ => (),
+                }
+                match Piece::try_from(symbol) {
+                    Ok(piece) => {
+                        let owner = match piece.owner {
+                            Player::White => &mut result.board.white_pieces,
+                            Player::Black => &mut result.board.black_pieces,
+                        };
+                        let square = Square::new(file.try_into()?, rank);
+                        *owner.bitboard_for(piece.kind) |= Bitboard::from(square);
+                    },
+                    Err(e) => return Err(e),
+                }
+                file += 1;
+            }
+            if file != BOARD_WIDTH {
+                bail!("incorrect FEN: rank size should be exactly {BOARD_WIDTH}, got {rank_fen} of length {file}");
+            }
+        }
+        if rank_id != 0 {
+            bail!("incorrect FEN: there should be 8 ranks, got {pieces_placement}");
+        }
+        result.side_to_move = match parts.next() {
+            Some(value) => value.try_into()?,
+            None => bail!("incorrect FEN: missing side to move"),
+        };
+        result.castling = match parts.next() {
+            Some(value) => value.try_into()?,
+            None => bail!("incorrect FEN: missing castling rights"),
+        };
+        result.en_passant_square = match parts.next() {
+            Some("-") => None,
+            Some(value) => Some(value.try_into()?),
+            None => bail!("incorrect FEN: missing en passant square"),
+        };
+        result.halfmove_clock = match parts.next() {
+            Some(value) => {
+                // TODO: Here and below: parse manually just by getting through
+                // ASCII digits since we're already checking them.
+                if !value.bytes().all(|c| c.is_ascii_digit()) {
+                    bail!("halfmove clock can not contain anything other than digits");
+                }
+                match value.parse::<u8>() {
+                    Ok(num) => num,
+                    Err(e) => {
+                        return Err(e).with_context(|| {
+                            format!("incorrect FEN: halfmove clock can not be parsed {value}")
+                        });
+                    },
+                }
+            },
+            // This is a correct EPD: exit early.
+            None => {
+                return match validate(&result) {
+                    Ok(_) => Ok(result),
+                    Err(e) => Err(e.context("illegal position")),
+                }
+            },
+        };
+        result.fullmove_counter = match parts.next() {
+            Some(value) => {
+                if !value.bytes().all(|c| c.is_ascii_digit()) {
+                    bail!("fullmove counter clock can not contain anything other than digits");
+                }
+                match value.parse::<u16>() {
+                    Ok(0) => {
+                        bail!("fullmove counter can not be 0")
+                    },
+                    Ok(num) => num,
+                    Err(e) => {
+                        return Err(e).with_context(|| {
+                            format!("incorrect FEN: fullmove counter can not be parsed {value}")
+                        });
+                    },
+                }
+            },
+            None => bail!("incorrect FEN: missing halfmove clock"),
+        };
+        match parts.next() {
+            None => match validate(&result) {
+                Ok(_) => Ok(result),
+                Err(e) => Err(e.context("illegal position")),
+            },
+            Some(_) => bail!("trailing symbols are not allowed in FEN"),
+        }
+    }
+
+    /// Returns a string representation of the position in FEN format.
+    #[must_use]
+    pub fn fen(&self) -> String {
+        self.to_string()
+    }
+
+    #[must_use]
+    pub fn has_insufficient_material(&self) -> bool {
+        todo!()
+    }
+
+    #[must_use]
+    pub fn is_legal(&self) -> bool {
+        validate(self).is_ok()
+    }
+
+    pub(super) fn attack_info(&self) -> attacks::AttackInfo {
+        let (us, they) = (self.us(), self.they());
+        let (our_pieces, their_pieces) = (self.pieces(us), self.pieces(they));
+        let king: Square = our_pieces.king.as_square();
+        let (our_occupancy, their_occupancy) = (our_pieces.all(), their_pieces.all());
+        let occupancy = our_occupancy | their_occupancy;
+        attacks::AttackInfo::new(they, their_pieces, king, our_occupancy, occupancy)
+    }
+
+    /// Calculates a list of legal moves (i.e. the moves that do not leave our
+    /// king in check).
+    ///
+    /// This is a performance and correctness-critical path: every modification
+    /// should be benchmarked and carefully tested.
+    ///
+    /// NOTE: [BMI Instruction Set] (and specifically efficient [PEXT]) is not
+    /// widely available on all processors (e.g. the AMD only started providing
+    /// an *efficient* PEXT since Ryzen 3). The current implementation will
+    /// rely on PEXT for performance because it is the most efficient move
+    /// generator technique available.
+    ///
+    /// [generation]: https://www.chessprogramming.org/Table-driven_Move_Generation
+    /// [BMI2 Pext Bitboards]: https://www.chessprogramming.org/BMI2#PEXTBitboards
+    /// [BMI Instruction Set]: https://en.wikipedia.org/wiki/X86_Bit_manipulation_instruction_set
+    /// [PEXT]: https://en.wikipedia.org/wiki/X86_Bit_manipulation_instruction_set#Parallel_bit_deposit_and_extract
+    // TODO: Fall back to Fancy Magic Bitboards if BMI2 is not available for
+    // portability?
+    // TODO: Look at and compare speed with https://github.com/jordanbray/chess
+    // TODO: Another source for comparison:
+    // https://github.com/sfleischman105/Pleco/blob/b825cecc258ad25cba65919208727994f38a06fb/pleco/src/board/movegen.rs#L68-L85
+    // TODO: Maybe use python-chess testset of perft moves:
+    // https://github.com/niklasf/python-chess/blob/master/examples/perft/random.perft
+    // TODO: Compare with other engines and perft generators
+    // (https://github.com/jniemann66/juddperft).
+    // TODO: Check movegen comparison (https://github.com/Gigantua/Chess_Movegen).
+    // TODO: Use monomorphization to generate code for calculating attacks for both sides to reduce
+    // branching? https://rustc-dev-guide.rust-lang.org/backend/monomorph.html
+    // TODO: Split into subroutines so that it's easier to tune performance.
+    #[must_use]
+    pub fn generate_moves(&self) -> MoveList {
+        let mut moves = MoveList::new();
+        // debug_assert!(validate(&self).is_ok(), "{}", self.fen());
+        // TODO: Try caching more e.g. all()s? Benchmark to confirm that this is an
+        // improvement.
+        let (us, they) = (self.us(), self.they());
+        let (our_pieces, their_pieces) = (self.pieces(us), self.pieces(they));
+        let king: Square = our_pieces.king.as_square();
+        let (our_occupancy, their_occupancy) = (our_pieces.all(), their_pieces.all());
+        let occupied_squares = our_occupancy | their_occupancy;
+        let their_or_empty = !our_occupancy;
+        let attack_info =
+            attacks::AttackInfo::new(they, their_pieces, king, our_occupancy, occupied_squares);
+        // Moving the king to safety is always a valid move.
+        generate_king_moves(king, attack_info.safe_king_squares, &mut moves);
+        // If there are checks, the moves are restricted to resolving them.
+        let blocking_ray = match attack_info.checkers.count() {
+            0 => Bitboard::full(),
+            // There are two ways of getting out of check:
+            //
+            // - Moving king to safety (calculated above)
+            // - Blocking the checker or capturing it
+            //
+            // The former is calculated above, the latter is dealt with below.
+            1 => {
+                let checker: Square = attack_info.checkers.as_square();
+                let ray = attacks::ray(checker, king);
+                if ray.is_empty() {
+                    // This means the checker is a knight: capture is the only
+                    // way left to resolve this check.
+                    attack_info.checkers
+                } else {
+                    // Checker is a sliding piece: both capturing and blocking
+                    // resolves the check.
+                    ray
+                }
+            },
+            // Double checks can only be evaded by the king moves to safety: no
+            // need to consider other moves.
+            2 => return moves,
+            _ => unreachable!("more than two pieces can not check the king"),
+        };
+        generate_knight_moves(
+            our_pieces.knights,
+            their_or_empty,
+            attack_info.pins,
+            blocking_ray,
+            &mut moves,
+        );
+        generate_rook_moves(
+            our_pieces.rooks | our_pieces.queens,
+            occupied_squares,
+            their_or_empty,
+            blocking_ray,
+            attack_info.pins,
+            king,
+            &mut moves,
+        );
+        generate_bishop_moves(
+            our_pieces.bishops | our_pieces.queens,
+            occupied_squares,
+            their_or_empty,
+            blocking_ray,
+            attack_info.pins,
+            king,
+            &mut moves,
+        );
+        generate_pawn_moves(
+            our_pieces.pawns,
+            us,
+            they,
+            their_pieces,
+            their_occupancy,
+            their_or_empty,
+            blocking_ray,
+            attack_info.pins,
+            attack_info.checkers,
+            king,
+            self.en_passant_square,
+            occupied_squares,
+            &mut moves,
+        );
+        generate_castle_moves(
+            us,
+            attack_info.checkers,
+            self.castling,
+            attack_info.attacks,
+            occupied_squares,
+            &mut moves,
+        );
+        moves
+    }
+
+    // TODO: Docs: this is the only way to mutate a position....
+    // TODO: Make an checked version of it? With the move coming from the UCI
+    // it's best to check if it's valid or not.
+    // TODO: Is it better to clone and return a new Position? It seems that the
+    // most usecases (e.g. for search) would clone the position and then mutate
+    // it anyway. This would prevent (im)mutability reference problems.
+    pub fn make_move(&mut self, next_move: &Move) {
+        // debug_assert!(self.is_legal());
+        let (us, they) = (self.us(), self.they());
+        let our_backrank = Rank::backrank(us);
+        let (our_pieces, their_pieces) = match self.us() {
+            Player::White => (&mut self.board.white_pieces, &mut self.board.black_pieces),
+            Player::Black => (&mut self.board.black_pieces, &mut self.board.white_pieces),
+        };
+        let previous_en_passant = self.en_passant_square;
+        self.en_passant_square = None;
+        if us == Player::Black {
+            self.fullmove_counter += 1;
+        }
+        self.halfmove_clock += 1;
+        // NOTE: We reset side_to_move early! To access the moving side, use cached
+        // `us`.
+        self.side_to_move = us.opponent();
+        // Handle captures.
+        if our_pieces.rooks.contains(next_move.from) {
+            match (us, next_move.from) {
+                (Player::White, Square::A1) => self.castling.remove(CastleRights::WHITE_LONG),
+                (Player::White, Square::H1) => self.castling.remove(CastleRights::WHITE_SHORT),
+                (Player::Black, Square::A8) => self.castling.remove(CastleRights::BLACK_LONG),
+                (Player::Black, Square::H8) => self.castling.remove(CastleRights::BLACK_SHORT),
+                _ => (),
+            }
+        }
+        if their_pieces.all().contains(next_move.to) {
+            // Capturing a piece resets the clock.
+            self.halfmove_clock = 0;
+            match (they, next_move.to) {
+                (Player::White, Square::H1) => self.castling.remove(CastleRights::WHITE_SHORT),
+                (Player::White, Square::A1) => self.castling.remove(CastleRights::WHITE_LONG),
+                (Player::Black, Square::H8) => self.castling.remove(CastleRights::BLACK_SHORT),
+                (Player::Black, Square::A8) => self.castling.remove(CastleRights::BLACK_LONG),
+                _ => (),
+            };
+            their_pieces.clear(next_move.to);
+        }
+        if our_pieces.pawns.contains(next_move.from) {
+            // Pawn move resets the clock.
+            self.halfmove_clock = 0;
+            // Check en passant.
+            if let Some(en_passant_square) = previous_en_passant {
+                if next_move.to == en_passant_square {
+                    let captured_pawn = Square::new(next_move.to.file(), next_move.from.rank());
+                    their_pieces.pawns.clear(captured_pawn);
+                }
+            }
+            our_pieces.pawns.clear(next_move.from);
+            // Check promotions.
+            // TODO: Debug assertions to make sure the promotion is valid.
+            if let Some(promotion) = next_move.promotion {
+                match promotion {
+                    Promotion::Queen => our_pieces.queens.extend(next_move.to),
+                    Promotion::Rook => our_pieces.rooks.extend(next_move.to),
+                    Promotion::Bishop => our_pieces.bishops.extend(next_move.to),
+                    Promotion::Knight => our_pieces.knights.extend(next_move.to),
+                };
+                return;
+            }
+            our_pieces.pawns.extend(next_move.to);
+            let single_push_square = next_move.from.shift(us.push_direction()).unwrap();
+            if next_move.from.rank() == Rank::pawns_starting(us)
+                && next_move.from.file() == next_move.to.file()
+                && single_push_square != next_move.to
+                // Technically, this is not correct: https://github.com/jhlywa/chess.js/issues/294
+                && (their_pieces.pawns & attacks::pawn_attacks(single_push_square, us)).has_any()
+            {
+                self.en_passant_square = Some(single_push_square);
+            }
+            return;
+        }
+        if our_pieces.king.contains(next_move.from) {
+            // Check if the move is castling.
+            if next_move.from.rank() == our_backrank
+                && next_move.to.rank() == our_backrank
+                && next_move.from.file() == File::E
+            {
+                if next_move.to.file() == File::G {
+                    // TODO: debug_assert!(self.can_castle_short())
+                    our_pieces.rooks.clear(Square::new(File::H, our_backrank));
+                    our_pieces.rooks.extend(Square::new(File::F, our_backrank));
+                } else if next_move.to.file() == File::C {
+                    // TODO: debug_assert!(self.can_castle_long())
+                    our_pieces.rooks.clear(Square::new(File::A, our_backrank));
+                    our_pieces.rooks.extend(Square::new(File::D, our_backrank));
+                }
+            }
+            our_pieces.king.clear(next_move.from);
+            our_pieces.king.extend(next_move.to);
+            // The king has moved: reset castling.
+            match us {
+                Player::White => self.castling.remove(CastleRights::WHITE_BOTH),
+                Player::Black => self.castling.remove(CastleRights::BLACK_BOTH),
+            };
+            return;
+        }
+        // Regular moves: put the piece from the source to destination. We
+        // already cleared the opponent piece if there was a capture.
+        for piece in [
+            &mut our_pieces.queens,
+            &mut our_pieces.rooks,
+            &mut our_pieces.bishops,
+            &mut our_pieces.knights,
+        ] {
+            if piece.contains(next_move.from) {
+                piece.clear(next_move.from);
+                piece.extend(next_move.to);
+                return;
+            }
+        }
+    }
+}
+
+impl TryFrom<&str> for Position {
+    type Error = anyhow::Error;
+
+    // TODO: Docs.
+    // TODO: Parse UCI position move1 move2 ...
+    fn try_from(input: &str) -> anyhow::Result<Self> {
+        let input = input.trim();
+        for prefix in ["fen ", "epd "] {
+            if let Some(stripped) = input.strip_prefix(prefix) {
+                return Self::from_fen(stripped);
+            }
+        }
+        Self::from_fen(input)
+    }
+}
+
+impl fmt::Display for Position {
+    /// Prints board in Forsyth-Edwards Notation.
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(f, "{} ", &self.board)?;
+        write!(f, "{} ", &self.side_to_move)?;
+        write!(f, "{} ", &self.castling)?;
+        match self.en_passant_square {
+            Some(square) => write!(f, "{square} "),
+            None => write!(f, "- "),
+        }?;
+        write!(f, "{} ", &self.halfmove_clock)?;
+        write!(f, "{}", &self.fullmove_counter)?;
+        Ok(())
+    }
+}
+
+impl fmt::Debug for Position {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        writeln!(f, "{:?}", &self.board)?;
+        writeln!(f, "Player to move: {:?}", &self.side_to_move)?;
+        writeln!(f, "Fullmove counter: {:?}", &self.fullmove_counter)?;
+        writeln!(f, "En Passant: {:?}", &self.en_passant_square)?;
+        // bitflags' default fmt::Debug implementation is not very convenient:
+        // dump FEN instead.
+        writeln!(f, "Castling rights: {}", &self.castling)?;
+        writeln!(f, "FEN: {}", &self.to_string())?;
+        Ok(())
+    }
+}
+
+/// [Perft] (**per**formance **t**esting) is a technique for checking
+/// correctness of move generation by traversing the tree of possible positions
+/// (nodes) and calculating all the leaf nodes at certain depth.
+///
+/// [Perft]: https://www.chessprogramming.org/Perft
+#[must_use]
+pub fn perft(position: &Position, depth: u8) -> u64 {
+    debug_assert!(position.is_legal());
+    if depth == 0 {
+        return 1;
+    }
+    let mut nodes = 0;
+    for next_move in position.generate_moves().iter() {
+        let mut next_position = position.clone();
+        next_position.make_move(next_move);
+        nodes += perft(&next_position, depth - 1);
+    }
+    nodes
+}
+
+// Checks if the position is "legal", i.e. if it can be reasoned about by
+// the engine. Checking whether the position is truly reachable from the
+// starting position (either in standard chess or Fischer Random Chess)
+// requires retrograde analysis and potentially unreasonable amount of time.
+// This check employs a limited number of heuristics that filter out the
+// most obvious incorrect positions and prevents them from being analyzed.
+// This helps set up barrier (constructing positions from FEN) between the
+// untrusted environment (UCI front-end, user input) and the engine.
+#[must_use]
+fn validate(position: &Position) -> anyhow::Result<()> {
+    if position.fullmove_counter == 0 {
+        bail!("fullmove counter cannot be zero")
+    }
+    // TODO: Probe opposite checks.
+    // TODO: The following patterns look repetitive; maybe refactor the
+    // common structure even though it's quite short?
+    if position.board.white_pieces.king.count() != 1 {
+        bail!(
+            "expected 1 white king, got {}",
+            position.board.white_pieces.king.count()
+        )
+    }
+    if position.board.black_pieces.king.count() != 1 {
+        bail!(
+            "expected 1 black king, got {}",
+            position.board.black_pieces.king.count()
+        )
+    }
+    if position.board.white_pieces.pawns.count() > 8 {
+        bail!(
+            "expected <= 8 white pawns, got {}",
+            position.board.white_pieces.pawns.count()
+        )
+    }
+    if position.board.black_pieces.pawns.count() > 8 {
+        bail!(
+            "expected <= 8 black pawns, got {}",
+            position.board.black_pieces.pawns.count()
+        )
+    }
+    if ((position.board.white_pieces.pawns | position.board.black_pieces.pawns)
+        & (Rank::One.mask() | Rank::Eight.mask()))
+    .has_any()
+    {
+        bail!("pawns can not be placed on backranks")
+    }
+    let attack_info = position.attack_info();
+    // Can't have more than two checks.
+    if attack_info.checkers.count() > 2 {
+        bail!("expected <= 2 checks, got {}", attack_info.checkers.count())
+    }
+    if let Some(en_passant_square) = position.en_passant_square {
+        let expected_rank = match position.side_to_move {
+            Player::White => Rank::Six,
+            Player::Black => Rank::Three,
+        };
+        if en_passant_square.rank() != expected_rank {
+            bail!(
+                "expected en passant square to be on rank {}, got {}",
+                expected_rank,
+                en_passant_square.rank()
+            )
+        }
+        // A pawn that was just pushed by our opponent should be in front of
+        // en_passant_square.
+        let pushed_pawn = en_passant_square
+            .shift(position.they().push_direction())
+            .unwrap();
+        if !position.pieces(position.they()).pawns.contains(pushed_pawn) {
+            bail!("en passant square is not beyond pushed pawn")
+        }
+        // If en-passant was played and there's a check, doubly pushed pawn
+        // should be the only checker or it should be a discovery.
+        let king = position.pieces(position.us()).king.as_square();
+        if attack_info.checkers.has_any() {
+            if attack_info.checkers.count() > 1 {
+                bail!("more than 1 check after double pawn push is impossible")
+            }
+            // The check wasn't delivered by pushed pawn.
+            if attack_info.checkers != Bitboard::from(pushed_pawn) {
+                let checker = attack_info.checkers.as_square();
+                let original_square = en_passant_square
+                    .shift(position.us().push_direction())
+                    .unwrap();
+                if !(attacks::ray(checker, king).contains(original_square)) {
+                    bail!(
+                        "the only possible checks after double pawn push are either discovery \
+                            targeting the original pawn square or the pushed pawn itself"
+                    )
+                }
+            }
+        }
+        // Doubly pushed pawn can not block a diagonal check.
+        for attacker in (position.pieces(position.they()).queens
+            | position.pieces(position.they()).bishops)
+            .iter()
+        {
+            let xray = attacks::bishop_ray(attacker, king);
+            if (xray & (position.occupied_squares())).count() == 2
+                && xray.contains(attacker)
+                && xray.contains(pushed_pawn)
+            {
+                bail!("doubly pushed pawn can not be the only blocker on a diagonal")
+            }
+        }
+    }
+    Ok(())
+}
+
+fn generate_king_moves(king: Square, safe_squares: Bitboard, moves: &mut MoveList) {
+    for safe_square in safe_squares.iter() {
+        unsafe {
+            moves.push_unchecked(Move::new(king, safe_square, None));
+        }
+    }
+}
+
+fn generate_knight_moves(
+    knights: Bitboard,
+    their_or_empty: Bitboard,
+    pins: Bitboard,
+    blocking_ray: Bitboard,
+    moves: &mut MoveList,
+) {
+    // When a knight is pinned, it can not move at all because it can't stay on
+    // the same horizontal, vertical or diagonal.
+    for from in (knights - pins).iter() {
+        let targets = attacks::knight_attacks(from) & their_or_empty & blocking_ray;
+        for to in targets.iter() {
+            unsafe {
+                moves.push_unchecked(Move::new(from, to, None));
+            }
+        }
+    }
+}
+
+fn generate_rook_moves(
+    rooks: Bitboard,
+    occupied_squares: Bitboard,
+    their_or_empty: Bitboard,
+    blocking_ray: Bitboard,
+    pins: Bitboard,
+    king: Square,
+    moves: &mut MoveList,
+) {
+    for from in rooks.iter() {
+        let targets = attacks::rook_attacks(from, occupied_squares) & their_or_empty & blocking_ray;
+        for to in targets.iter() {
+            // TODO: This block is repeated several times; abstract it out.
+            if pins.contains(from) && (attacks::ray(from, king) & attacks::ray(to, king)).is_empty()
+            {
+                continue;
+            }
+            unsafe { moves.push_unchecked(Move::new(from, to, None)) }
+        }
+    }
+}
+
+fn generate_bishop_moves(
+    bishops: Bitboard,
+    occupied_squares: Bitboard,
+    their_or_empty: Bitboard,
+    blocking_ray: Bitboard,
+    pins: Bitboard,
+    king: Square,
+    moves: &mut MoveList,
+) {
+    for from in bishops.iter() {
+        let targets =
+            attacks::bishop_attacks(from, occupied_squares) & their_or_empty & blocking_ray;
+        for to in targets.iter() {
+            // TODO: This block is repeated several times; abstract it out.
+            if pins.contains(from) && (attacks::ray(from, king) & attacks::ray(to, king)).is_empty()
+            {
+                continue;
+            }
+            unsafe { moves.push_unchecked(Move::new(from, to, None)) }
+        }
+    }
+}
+
+fn generate_pawn_moves(
+    pawns: Bitboard,
+    us: Player,
+    they: Player,
+    their_pieces: &Pieces,
+    their_occupancy: Bitboard,
+    their_or_empty: Bitboard,
+    blocking_ray: Bitboard,
+    pins: Bitboard,
+    checkers: Bitboard,
+    king: Square,
+    en_passant_square: Option<Square>,
+    occupied_squares: Bitboard,
+    moves: &mut MoveList,
+) {
+    // TODO: Get rid of the branch: AND pawns getting to the promotion rank and the
+    // rest.
+    for from in pawns.iter() {
+        let targets =
+            (attacks::pawn_attacks(from, us) & their_occupancy) & their_or_empty & blocking_ray;
+        for to in targets.iter() {
+            // TODO: This block is repeated several times; abstract it out.
+            if pins.contains(from) && (attacks::ray(from, king) & attacks::ray(to, king)).is_empty()
+            {
+                continue;
+            }
+            match to.rank() {
+                Rank::One | Rank::Eight => unsafe {
+                    moves.push_unchecked(Move::new(from, to, Some(Promotion::Queen)));
+                    moves.push_unchecked(Move::new(from, to, Some(Promotion::Rook)));
+                    moves.push_unchecked(Move::new(from, to, Some(Promotion::Bishop)));
+                    moves.push_unchecked(Move::new(from, to, Some(Promotion::Knight)));
+                },
+                _ => unsafe { moves.push_unchecked(Move::new(from, to, None)) },
+            }
+        }
+    }
+    // Generate en passant moves.
+    if let Some(en_passant_square) = en_passant_square {
+        let en_passant_pawn = en_passant_square.shift(they.push_direction()).unwrap();
+        // Check if capturing en passant resolves the check.
+        let candidate_pawns = attacks::pawn_attacks(en_passant_square, they) & pawns;
+        if checkers.contains(en_passant_pawn) {
+            for our_pawn in candidate_pawns.iter() {
+                if pins.contains(our_pawn) {
+                    continue;
+                }
+                unsafe {
+                    moves.push_unchecked(Move::new(our_pawn, en_passant_square, None));
+                }
+            }
+        } else {
+            // Check if capturing en passant does not create a discovered check.
+            for our_pawn in candidate_pawns.iter() {
+                let mut occupancy_after_capture = occupied_squares;
+                occupancy_after_capture.clear(our_pawn);
+                occupancy_after_capture.clear(en_passant_pawn);
+                occupancy_after_capture.extend(en_passant_square);
+                if (attacks::queen_attacks(king, occupancy_after_capture) & their_pieces.queens)
+                    .is_empty()
+                    && (attacks::rook_attacks(king, occupancy_after_capture) & their_pieces.rooks)
+                        .is_empty()
+                    && (attacks::bishop_attacks(king, occupancy_after_capture)
+                        & their_pieces.bishops)
+                        .is_empty()
+                {
+                    unsafe {
+                        moves.push_unchecked(Move::new(our_pawn, en_passant_square, None));
+                    }
+                }
+            }
+        }
+    }
+    // Regular pawn pushes.
+    let push_direction = us.push_direction();
+    let pawn_pushes = pawns.shift(push_direction) - occupied_squares;
+    let original_squares = pawn_pushes.shift(push_direction.opposite());
+    let add_pawn_moves = |moves: &mut MoveList, from, to: Square| {
+        // TODO: This is probably better with self.side_to_move.opponent().backrank()
+        // but might be slower.
+        match to.rank() {
+            Rank::Eight | Rank::One => unsafe {
+                moves.push_unchecked(Move::new(from, to, Some(Promotion::Queen)));
+                moves.push_unchecked(Move::new(from, to, Some(Promotion::Rook)));
+                moves.push_unchecked(Move::new(from, to, Some(Promotion::Bishop)));
+                moves.push_unchecked(Move::new(from, to, Some(Promotion::Knight)));
+            },
+            _ => unsafe { moves.push_unchecked(Move::new(from, to, None)) },
+        }
+    };
+    for (from, to) in itertools::zip(original_squares.iter(), pawn_pushes.iter()) {
+        if !blocking_ray.contains(to) {
+            continue;
+        }
+        if pins.contains(from) && (attacks::ray(from, king) & attacks::ray(to, king)).is_empty() {
+            continue;
+        }
+        add_pawn_moves(moves, from, to);
+    }
+    // Double pawn pushes.
+    // TODO: Come up with a better name for it.
+    let third_rank = Rank::pawns_starting(us).mask().shift(push_direction);
+    let double_pushes = (pawn_pushes & third_rank).shift(push_direction) - occupied_squares;
+    let original_squares = double_pushes
+        .shift(push_direction.opposite())
+        .shift(push_direction.opposite());
+    // Double pawn pushes are never promoting.
+    for (from, to) in itertools::zip(original_squares.iter(), double_pushes.iter()) {
+        if !blocking_ray.contains(to) {
+            continue;
+        }
+        if pins.contains(from) && (attacks::ray(from, king) & attacks::ray(to, king)).is_empty() {
+            continue;
+        }
+        unsafe {
+            moves.push_unchecked(Move::new(from, to, None));
+        }
+    }
+}
+
+fn generate_castle_moves(
+    us: Player,
+    checkers: Bitboard,
+    castling: CastleRights,
+    attacks: Bitboard,
+    occupied_squares: Bitboard,
+    moves: &mut MoveList,
+) {
+    // TODO: Generalize castling to FCR.
+    // TODO: In FCR we should check if the rook is pinned or not.
+    if checkers.is_empty() {
+        match us {
+            Player::White => {
+                if castling.contains(CastleRights::WHITE_SHORT)
+                    && (attacks & attacks::WHITE_SHORT_CASTLE_KING_WALK).is_empty()
+                    && (occupied_squares
+                        & (attacks::WHITE_SHORT_CASTLE_KING_WALK
+                            | attacks::WHITE_SHORT_CASTLE_ROOK_WALK))
+                        .is_empty()
+                {
+                    unsafe {
+                        moves.push_unchecked(Move::new(Square::E1, Square::G1, None));
+                    }
+                }
+                if castling.contains(CastleRights::WHITE_LONG)
+                    && (attacks & attacks::WHITE_LONG_CASTLE_KING_WALK).is_empty()
+                    && (occupied_squares
+                        & (attacks::WHITE_LONG_CASTLE_KING_WALK
+                            | attacks::WHITE_LONG_CASTLE_ROOK_WALK))
+                        .is_empty()
+                {
+                    unsafe {
+                        moves.push_unchecked(Move::new(Square::E1, Square::C1, None));
+                    }
+                }
+            },
+            Player::Black => {
+                if castling.contains(CastleRights::BLACK_SHORT)
+                    && (attacks & attacks::BLACK_SHORT_CASTLE_KING_WALK).is_empty()
+                    && (occupied_squares
+                        & (attacks::BLACK_SHORT_CASTLE_KING_WALK
+                            | attacks::BLACK_SHORT_CASTLE_ROOK_WALK))
+                        .is_empty()
+                {
+                    unsafe {
+                        moves.push_unchecked(Move::new(Square::E8, Square::G8, None));
+                    }
+                }
+                if castling.contains(CastleRights::BLACK_LONG)
+                    && (attacks & attacks::BLACK_LONG_CASTLE_KING_WALK).is_empty()
+                    && (occupied_squares
+                        & (attacks::BLACK_LONG_CASTLE_KING_WALK
+                            | attacks::BLACK_LONG_CASTLE_ROOK_WALK))
+                        .is_empty()
+                {
+                    unsafe {
+                        moves.push_unchecked(Move::new(Square::E8, Square::C8, None));
+                    }
+                }
+            },
+        }
+    }
+}
+
\ No newline at end of file diff --git a/docs/src/pabi/evaluation.rs.html b/docs/src/pabi/evaluation.rs.html new file mode 100644 index 00000000..5115f36c --- /dev/null +++ b/docs/src/pabi/evaluation.rs.html @@ -0,0 +1,5 @@ +evaluation.rs - source +
1
+
pub mod evaluator;
+
\ No newline at end of file diff --git a/docs/src/pabi/evaluation/evaluator.rs.html b/docs/src/pabi/evaluation/evaluator.rs.html new file mode 100644 index 00000000..9c8fef87 --- /dev/null +++ b/docs/src/pabi/evaluation/evaluator.rs.html @@ -0,0 +1,5 @@ +evaluator.rs - source +
1
+
pub trait Evaluator {}
+
\ No newline at end of file diff --git a/docs/src/pabi/interface.rs.html b/docs/src/pabi/interface.rs.html new file mode 100644 index 00000000..d47d3589 --- /dev/null +++ b/docs/src/pabi/interface.rs.html @@ -0,0 +1,9 @@ +interface.rs - source +
1
+2
+3
+
//! Interface between the engine and the front-end (tournament runner or GUI).
+
+pub mod uci;
+
\ No newline at end of file diff --git a/docs/src/pabi/interface/uci.rs.html b/docs/src/pabi/interface/uci.rs.html new file mode 100644 index 00000000..47498ea8 --- /dev/null +++ b/docs/src/pabi/interface/uci.rs.html @@ -0,0 +1,5 @@ +uci.rs - source +
1
+
fn run() {}
+
\ No newline at end of file diff --git a/docs/src/pabi/lib.rs.html b/docs/src/pabi/lib.rs.html new file mode 100644 index 00000000..c4cd7fa4 --- /dev/null +++ b/docs/src/pabi/lib.rs.html @@ -0,0 +1,157 @@ +lib.rs - source +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+
//! Modern and high-quality chess engine. For more information, see
+//!
+//! - [README] explaining about design and implementation goals
+//! - [Resources] for information on important papers, other engines and
+//!   prominent research ideas
+//!
+//! [README]: https://github.com/kirillbobyrev/pabi/blob/main/README.md
+//! [Resources]: https://github.com/kirillbobyrev/pabi/wiki/Resources
+
+// TODO: Gradually move most of warnings to deny.
+#![warn(missing_docs, variant_size_differences)]
+// Rustc lints.
+#![warn(
+    absolute_paths_not_starting_with_crate,
+    keyword_idents,
+    macro_use_extern_crate,
+    trivial_casts,
+    trivial_numeric_casts,
+    unreachable_pub,
+    unused_extern_crates,
+    unused_import_braces,
+    unused_lifetimes,
+    unused_qualifications,
+    unused_results
+)]
+// Rustdoc lints.
+#![warn(
+    rustdoc::missing_doc_code_examples,
+    rustdoc::private_doc_tests,
+    rustdoc::missing_crate_level_docs,
+    rustdoc::broken_intra_doc_links,
+    rustdoc::invalid_codeblock_attributes,
+    rustdoc::invalid_html_tags,
+    rustdoc::invalid_rust_codeblocks,
+    rustdoc::bare_urls
+)]
+// Clippy lints.
+#![warn(
+    clippy::perf,
+    clippy::pedantic,
+    clippy::style,
+    clippy::nursery,
+    clippy::complexity,
+    clippy::correctness,
+    clippy::cargo
+)]
+
+// TODO: Re-export types for convenience.
+pub mod chess;
+pub mod evaluation;
+pub mod interface;
+
+pub mod util;
+
+use sysinfo::System;
+
+pub const VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/version"));
+
+/// Prints information about the host system.
+pub fn print_system_info() {
+    let sys = System::new_all();
+    println!(
+        "System: {}",
+        System::long_os_version().unwrap_or_else(|| "UNKNOWN".to_string())
+    );
+    println!(
+        "System kernel version: {}",
+        System::kernel_version().unwrap_or_else(|| "UNKNOWN".to_string())
+    );
+    println!(
+        "Host name: {}",
+        System::host_name().unwrap_or_else(|| "UNKNOWN".to_string())
+    );
+    // Convert returned KB to GB.
+    println!("RAM: {} GB", sys.total_memory() / 1_000_000);
+    println!("Physical cores: {}", sys.physical_core_count().unwrap());
+}
+
\ No newline at end of file diff --git a/docs/src/pabi/util.rs.html b/docs/src/pabi/util.rs.html new file mode 100644 index 00000000..602d3394 --- /dev/null +++ b/docs/src/pabi/util.rs.html @@ -0,0 +1,41 @@ +util.rs - source +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+
//! Convenient utility functions for Pabi that can be used from benchmarks and
+//! public tests.
+
+// TODO: Docs.
+#[must_use]
+pub fn sanitize_fen(position: &str) -> String {
+    let mut position = position.trim();
+    for prefix in ["fen ", "epd "] {
+        if let Some(stripped) = position.strip_prefix(prefix) {
+            position = stripped;
+        }
+    }
+    match position.split_ascii_whitespace().count() {
+        6 => position.to_string(),
+        // Patch EPD to validate produced FEN.
+        4 => position.to_string() + " 0 1",
+        _ => unreachable!(),
+    }
+}
+
\ No newline at end of file diff --git a/docs/static.files/COPYRIGHT-23e9bde6c69aea69.txt b/docs/static.files/COPYRIGHT-23e9bde6c69aea69.txt new file mode 100644 index 00000000..1447df79 --- /dev/null +++ b/docs/static.files/COPYRIGHT-23e9bde6c69aea69.txt @@ -0,0 +1,50 @@ +# REUSE-IgnoreStart + +These documentation pages include resources by third parties. This copyright +file applies only to those resources. The following third party resources are +included, and carry their own copyright notices and license terms: + +* Fira Sans (FiraSans-Regular.woff2, FiraSans-Medium.woff2): + + Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ + with Reserved Font Name Fira Sans. + + Copyright (c) 2014, Telefonica S.A. + + Licensed under the SIL Open Font License, Version 1.1. + See FiraSans-LICENSE.txt. + +* rustdoc.css, main.js, and playpen.js: + + Copyright 2015 The Rust Developers. + Licensed under the Apache License, Version 2.0 (see LICENSE-APACHE.txt) or + the MIT license (LICENSE-MIT.txt) at your option. + +* normalize.css: + + Copyright (c) Nicolas Gallagher and Jonathan Neal. + Licensed under the MIT license (see LICENSE-MIT.txt). + +* Source Code Pro (SourceCodePro-Regular.ttf.woff2, + SourceCodePro-Semibold.ttf.woff2, SourceCodePro-It.ttf.woff2): + + Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), + with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark + of Adobe Systems Incorporated in the United States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceCodePro-LICENSE.txt. + +* Source Serif 4 (SourceSerif4-Regular.ttf.woff2, SourceSerif4-Bold.ttf.woff2, + SourceSerif4-It.ttf.woff2): + + Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name + 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United + States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceSerif4-LICENSE.md. + +This copyright file is intended to be distributed with rustdoc output. + +# REUSE-IgnoreEnd diff --git a/docs/static.files/FiraSans-LICENSE-db4b642586e02d97.txt b/docs/static.files/FiraSans-LICENSE-db4b642586e02d97.txt new file mode 100644 index 00000000..d7e9c149 --- /dev/null +++ b/docs/static.files/FiraSans-LICENSE-db4b642586e02d97.txt @@ -0,0 +1,98 @@ +// REUSE-IgnoreStart + +Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A. +with Reserved Font Name < Fira >, + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/docs/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 b/docs/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 new file mode 100644 index 00000000..7a1e5fc5 Binary files /dev/null and b/docs/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 differ diff --git a/docs/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 b/docs/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 new file mode 100644 index 00000000..e766e06c Binary files /dev/null and b/docs/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 differ diff --git a/docs/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt b/docs/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt new file mode 100644 index 00000000..16fe87b0 --- /dev/null +++ b/docs/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/docs/static.files/LICENSE-MIT-65090b722b3f6c56.txt b/docs/static.files/LICENSE-MIT-65090b722b3f6c56.txt new file mode 100644 index 00000000..31aa7938 --- /dev/null +++ b/docs/static.files/LICENSE-MIT-65090b722b3f6c56.txt @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/docs/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 b/docs/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 new file mode 100644 index 00000000..1866ad4b Binary files /dev/null and b/docs/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 differ diff --git a/docs/static.files/NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt b/docs/static.files/NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt new file mode 100644 index 00000000..4b3edc29 --- /dev/null +++ b/docs/static.files/NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt @@ -0,0 +1,103 @@ +// REUSE-IgnoreStart + +Copyright (c) 2010, NAVER Corporation (https://www.navercorp.com/), + +with Reserved Font Name Nanum, Naver Nanum, NanumGothic, Naver NanumGothic, +NanumMyeongjo, Naver NanumMyeongjo, NanumBrush, Naver NanumBrush, NanumPen, +Naver NanumPen, Naver NanumGothicEco, NanumGothicEco, Naver NanumMyeongjoEco, +NanumMyeongjoEco, Naver NanumGothicLight, NanumGothicLight, NanumBarunGothic, +Naver NanumBarunGothic, NanumSquareRound, NanumBarunPen, MaruBuri + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/docs/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 b/docs/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 new file mode 100644 index 00000000..462c34ef Binary files /dev/null and b/docs/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 differ diff --git a/docs/static.files/SourceCodePro-LICENSE-d180d465a756484a.txt b/docs/static.files/SourceCodePro-LICENSE-d180d465a756484a.txt new file mode 100644 index 00000000..0d2941e1 --- /dev/null +++ b/docs/static.files/SourceCodePro-LICENSE-d180d465a756484a.txt @@ -0,0 +1,97 @@ +// REUSE-IgnoreStart + +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/docs/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 b/docs/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 new file mode 100644 index 00000000..10b558e0 Binary files /dev/null and b/docs/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 differ diff --git a/docs/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 b/docs/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 new file mode 100644 index 00000000..5ec64eef Binary files /dev/null and b/docs/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 differ diff --git a/docs/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 b/docs/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 new file mode 100644 index 00000000..181a07f6 Binary files /dev/null and b/docs/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 differ diff --git a/docs/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 b/docs/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 new file mode 100644 index 00000000..2ae08a7b Binary files /dev/null and b/docs/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 differ diff --git a/docs/static.files/SourceSerif4-LICENSE-3bb119e13b1258b7.md b/docs/static.files/SourceSerif4-LICENSE-3bb119e13b1258b7.md new file mode 100644 index 00000000..175fa4f4 --- /dev/null +++ b/docs/static.files/SourceSerif4-LICENSE-3bb119e13b1258b7.md @@ -0,0 +1,98 @@ + + +Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. +Copyright 2014 - 2023 Adobe (http://www.adobe.com/), with Reserved Font Name ‘Source’. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + + diff --git a/docs/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 b/docs/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 new file mode 100644 index 00000000..0263fc30 Binary files /dev/null and b/docs/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 differ diff --git a/docs/static.files/clipboard-7571035ce49a181d.svg b/docs/static.files/clipboard-7571035ce49a181d.svg new file mode 100644 index 00000000..8adbd996 --- /dev/null +++ b/docs/static.files/clipboard-7571035ce49a181d.svg @@ -0,0 +1 @@ + diff --git a/docs/static.files/favicon-16x16-8b506e7a72182f1c.png b/docs/static.files/favicon-16x16-8b506e7a72182f1c.png new file mode 100644 index 00000000..ea4b45ca Binary files /dev/null and b/docs/static.files/favicon-16x16-8b506e7a72182f1c.png differ diff --git a/docs/static.files/favicon-2c020d218678b618.svg b/docs/static.files/favicon-2c020d218678b618.svg new file mode 100644 index 00000000..8b34b511 --- /dev/null +++ b/docs/static.files/favicon-2c020d218678b618.svg @@ -0,0 +1,24 @@ + + + + + diff --git a/docs/static.files/favicon-32x32-422f7d1d52889060.png b/docs/static.files/favicon-32x32-422f7d1d52889060.png new file mode 100644 index 00000000..69b8613c Binary files /dev/null and b/docs/static.files/favicon-32x32-422f7d1d52889060.png differ diff --git a/docs/static.files/main-12cf3b4f4f9dc36d.js b/docs/static.files/main-12cf3b4f4f9dc36d.js new file mode 100644 index 00000000..1d8d1ccb --- /dev/null +++ b/docs/static.files/main-12cf3b4f4f9dc36d.js @@ -0,0 +1,11 @@ +"use strict";window.RUSTDOC_TOOLTIP_HOVER_MS=300;window.RUSTDOC_TOOLTIP_HOVER_EXIT_MS=450;function resourcePath(basename,extension){return getVar("root-path")+basename+getVar("resource-suffix")+extension}function hideMain(){addClass(document.getElementById(MAIN_ID),"hidden")}function showMain(){removeClass(document.getElementById(MAIN_ID),"hidden")}function blurHandler(event,parentElem,hideCallback){if(!parentElem.contains(document.activeElement)&&!parentElem.contains(event.relatedTarget)){hideCallback()}}window.rootPath=getVar("root-path");window.currentCrate=getVar("current-crate");function setMobileTopbar(){const mobileTopbar=document.querySelector(".mobile-topbar");const locationTitle=document.querySelector(".sidebar h2.location");if(mobileTopbar){const mobileTitle=document.createElement("h2");mobileTitle.className="location";if(hasClass(document.querySelector(".rustdoc"),"crate")){mobileTitle.innerHTML=`Crate ${window.currentCrate}`}else if(locationTitle){mobileTitle.innerHTML=locationTitle.innerHTML}mobileTopbar.appendChild(mobileTitle)}}function getVirtualKey(ev){if("key"in ev&&typeof ev.key!=="undefined"){return ev.key}const c=ev.charCode||ev.keyCode;if(c===27){return"Escape"}return String.fromCharCode(c)}const MAIN_ID="main-content";const SETTINGS_BUTTON_ID="settings-menu";const ALTERNATIVE_DISPLAY_ID="alternative-display";const NOT_DISPLAYED_ID="not-displayed";const HELP_BUTTON_ID="help-button";function getSettingsButton(){return document.getElementById(SETTINGS_BUTTON_ID)}function getHelpButton(){return document.getElementById(HELP_BUTTON_ID)}function getNakedUrl(){return window.location.href.split("?")[0].split("#")[0]}function insertAfter(newNode,referenceNode){referenceNode.parentNode.insertBefore(newNode,referenceNode.nextSibling)}function getOrCreateSection(id,classes){let el=document.getElementById(id);if(!el){el=document.createElement("section");el.id=id;el.className=classes;insertAfter(el,document.getElementById(MAIN_ID))}return el}function getAlternativeDisplayElem(){return getOrCreateSection(ALTERNATIVE_DISPLAY_ID,"content hidden")}function getNotDisplayedElem(){return getOrCreateSection(NOT_DISPLAYED_ID,"hidden")}function switchDisplayedElement(elemToDisplay){const el=getAlternativeDisplayElem();if(el.children.length>0){getNotDisplayedElem().appendChild(el.firstElementChild)}if(elemToDisplay===null){addClass(el,"hidden");showMain();return}el.appendChild(elemToDisplay);hideMain();removeClass(el,"hidden")}function browserSupportsHistoryApi(){return window.history&&typeof window.history.pushState==="function"}function preLoadCss(cssUrl){const link=document.createElement("link");link.href=cssUrl;link.rel="preload";link.as="style";document.getElementsByTagName("head")[0].appendChild(link)}(function(){const isHelpPage=window.location.pathname.endsWith("/help.html");function loadScript(url,errorCallback){const script=document.createElement("script");script.src=url;if(errorCallback!==undefined){script.onerror=errorCallback}document.head.append(script)}getSettingsButton().onclick=event=>{if(event.ctrlKey||event.altKey||event.metaKey){return}window.hideAllModals(false);addClass(getSettingsButton(),"rotate");event.preventDefault();loadScript(getVar("static-root-path")+getVar("settings-js"));setTimeout(()=>{const themes=getVar("themes").split(",");for(const theme of themes){if(theme!==""){preLoadCss(getVar("root-path")+theme+".css")}}},0)};window.searchState={loadingText:"Loading search results...",input:document.getElementsByClassName("search-input")[0],outputElement:()=>{let el=document.getElementById("search");if(!el){el=document.createElement("section");el.id="search";getNotDisplayedElem().appendChild(el)}return el},title:document.title,titleBeforeSearch:document.title,timeout:null,currentTab:0,focusedByTab:[null,null,null],clearInputTimeout:()=>{if(searchState.timeout!==null){clearTimeout(searchState.timeout);searchState.timeout=null}},isDisplayed:()=>searchState.outputElement().parentElement.id===ALTERNATIVE_DISPLAY_ID,focus:()=>{searchState.input.focus()},defocus:()=>{searchState.input.blur()},showResults:search=>{if(search===null||typeof search==="undefined"){search=searchState.outputElement()}switchDisplayedElement(search);searchState.mouseMovedAfterSearch=false;document.title=searchState.title},removeQueryParameters:()=>{document.title=searchState.titleBeforeSearch;if(browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.hash)}},hideResults:()=>{switchDisplayedElement(null);searchState.removeQueryParameters()},getQueryStringParams:()=>{const params={};window.location.search.substring(1).split("&").map(s=>{const pair=s.split("=").map(x=>x.replace(/\+/g," "));params[decodeURIComponent(pair[0])]=typeof pair[1]==="undefined"?null:decodeURIComponent(pair[1])});return params},setup:()=>{const search_input=searchState.input;if(!searchState.input){return}let searchLoaded=false;function sendSearchForm(){document.getElementsByClassName("search-form")[0].submit()}function loadSearch(){if(!searchLoaded){searchLoaded=true;loadScript(getVar("static-root-path")+getVar("search-js"),sendSearchForm);loadScript(resourcePath("search-index",".js"),sendSearchForm)}}search_input.addEventListener("focus",()=>{search_input.origPlaceholder=search_input.placeholder;search_input.placeholder="Type your search here.";loadSearch()});if(search_input.value!==""){loadSearch()}const params=searchState.getQueryStringParams();if(params.search!==undefined){searchState.setLoadingSearch();loadSearch()}},setLoadingSearch:()=>{const search=searchState.outputElement();search.innerHTML="

"+searchState.loadingText+"

";searchState.showResults(search)},};const toggleAllDocsId="toggle-all-docs";let savedHash="";function handleHashes(ev){if(ev!==null&&searchState.isDisplayed()&&ev.newURL){switchDisplayedElement(null);const hash=ev.newURL.slice(ev.newURL.indexOf("#")+1);if(browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.search+"#"+hash)}const elem=document.getElementById(hash);if(elem){elem.scrollIntoView()}}const pageId=window.location.hash.replace(/^#/,"");if(savedHash!==pageId){savedHash=pageId;if(pageId!==""){expandSection(pageId)}}if(savedHash.startsWith("impl-")){const splitAt=savedHash.indexOf("/");if(splitAt!==-1){const implId=savedHash.slice(0,splitAt);const assocId=savedHash.slice(splitAt+1);const implElem=document.getElementById(implId);if(implElem&&implElem.parentElement.tagName==="SUMMARY"&&implElem.parentElement.parentElement.tagName==="DETAILS"){onEachLazy(implElem.parentElement.parentElement.querySelectorAll(`[id^="${assocId}"]`),item=>{const numbered=/([^-]+)-([0-9]+)/.exec(item.id);if(item.id===assocId||(numbered&&numbered[1]===assocId)){openParentDetails(item);item.scrollIntoView();setTimeout(()=>{window.location.replace("#"+item.id)},0)}})}}}}function onHashChange(ev){hideSidebar();handleHashes(ev)}function openParentDetails(elem){while(elem){if(elem.tagName==="DETAILS"){elem.open=true}elem=elem.parentNode}}function expandSection(id){openParentDetails(document.getElementById(id))}function handleEscape(ev){searchState.clearInputTimeout();searchState.hideResults();ev.preventDefault();searchState.defocus();window.hideAllModals(true)}function handleShortcut(ev){const disableShortcuts=getSettingValue("disable-shortcuts")==="true";if(ev.ctrlKey||ev.altKey||ev.metaKey||disableShortcuts){return}if(document.activeElement.tagName==="INPUT"&&document.activeElement.type!=="checkbox"&&document.activeElement.type!=="radio"){switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break}}else{switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break;case"s":case"S":ev.preventDefault();searchState.focus();break;case"+":ev.preventDefault();expandAllDocs();break;case"-":ev.preventDefault();collapseAllDocs();break;case"?":showHelp();break;default:break}}}document.addEventListener("keypress",handleShortcut);document.addEventListener("keydown",handleShortcut);function addSidebarItems(){if(!window.SIDEBAR_ITEMS){return}const sidebar=document.getElementsByClassName("sidebar-elems")[0];function block(shortty,id,longty){const filtered=window.SIDEBAR_ITEMS[shortty];if(!filtered){return}const modpath=hasClass(document.querySelector(".rustdoc"),"mod")?"../":"";const h3=document.createElement("h3");h3.innerHTML=`${longty}`;const ul=document.createElement("ul");ul.className="block "+shortty;for(const name of filtered){let path;if(shortty==="mod"){path=`${modpath}${name}/index.html`}else{path=`${modpath}${shortty}.${name}.html`}let current_page=document.location.href.toString();if(current_page.endsWith("/")){current_page+="index.html"}const link=document.createElement("a");link.href=path;if(path===current_page){link.className="current"}link.textContent=name;const li=document.createElement("li");li.appendChild(link);ul.appendChild(li)}sidebar.appendChild(h3);sidebar.appendChild(ul)}if(sidebar){block("primitive","primitives","Primitive Types");block("mod","modules","Modules");block("macro","macros","Macros");block("struct","structs","Structs");block("enum","enums","Enums");block("constant","constants","Constants");block("static","static","Statics");block("trait","traits","Traits");block("fn","functions","Functions");block("type","types","Type Aliases");block("union","unions","Unions");block("foreigntype","foreign-types","Foreign Types");block("keyword","keywords","Keywords");block("opaque","opaque-types","Opaque Types");block("attr","attributes","Attribute Macros");block("derive","derives","Derive Macros");block("traitalias","trait-aliases","Trait Aliases")}}window.register_implementors=imp=>{const implementors=document.getElementById("implementors-list");const synthetic_implementors=document.getElementById("synthetic-implementors-list");const inlined_types=new Set();const TEXT_IDX=0;const SYNTHETIC_IDX=1;const TYPES_IDX=2;if(synthetic_implementors){onEachLazy(synthetic_implementors.getElementsByClassName("impl"),el=>{const aliases=el.getAttribute("data-aliases");if(!aliases){return}aliases.split(",").forEach(alias=>{inlined_types.add(alias)})})}let currentNbImpls=implementors.getElementsByClassName("impl").length;const traitName=document.querySelector(".main-heading h1 > .trait").textContent;const baseIdName="impl-"+traitName+"-";const libs=Object.getOwnPropertyNames(imp);const script=document.querySelector("script[data-ignore-extern-crates]");const ignoreExternCrates=new Set((script?script.getAttribute("data-ignore-extern-crates"):"").split(","));for(const lib of libs){if(lib===window.currentCrate||ignoreExternCrates.has(lib)){continue}const structs=imp[lib];struct_loop:for(const struct of structs){const list=struct[SYNTHETIC_IDX]?synthetic_implementors:implementors;if(struct[SYNTHETIC_IDX]){for(const struct_type of struct[TYPES_IDX]){if(inlined_types.has(struct_type)){continue struct_loop}inlined_types.add(struct_type)}}const code=document.createElement("h3");code.innerHTML=struct[TEXT_IDX];addClass(code,"code-header");onEachLazy(code.getElementsByTagName("a"),elem=>{const href=elem.getAttribute("href");if(href&&!href.startsWith("#")&&!/^(?:[a-z+]+:)?\/\//.test(href)){elem.setAttribute("href",window.rootPath+href)}});const currentId=baseIdName+currentNbImpls;const anchor=document.createElement("a");anchor.href="#"+currentId;addClass(anchor,"anchor");const display=document.createElement("div");display.id=currentId;addClass(display,"impl");display.appendChild(anchor);display.appendChild(code);list.appendChild(display);currentNbImpls+=1}}};if(window.pending_implementors){window.register_implementors(window.pending_implementors)}window.register_type_impls=imp=>{if(!imp||!imp[window.currentCrate]){return}window.pending_type_impls=null;const idMap=new Map();let implementations=document.getElementById("implementations-list");let trait_implementations=document.getElementById("trait-implementations-list");let trait_implementations_header=document.getElementById("trait-implementations");const script=document.querySelector("script[data-self-path]");const selfPath=script?script.getAttribute("data-self-path"):null;const mainContent=document.querySelector("#main-content");const sidebarSection=document.querySelector(".sidebar section");let methods=document.querySelector(".sidebar .block.method");let associatedTypes=document.querySelector(".sidebar .block.associatedtype");let associatedConstants=document.querySelector(".sidebar .block.associatedconstant");let sidebarTraitList=document.querySelector(".sidebar .block.trait-implementation");for(const impList of imp[window.currentCrate]){const types=impList.slice(2);const text=impList[0];const isTrait=impList[1]!==0;const traitName=impList[1];if(types.indexOf(selfPath)===-1){continue}let outputList=isTrait?trait_implementations:implementations;if(outputList===null){const outputListName=isTrait?"Trait Implementations":"Implementations";const outputListId=isTrait?"trait-implementations-list":"implementations-list";const outputListHeaderId=isTrait?"trait-implementations":"implementations";const outputListHeader=document.createElement("h2");outputListHeader.id=outputListHeaderId;outputListHeader.innerText=outputListName;outputList=document.createElement("div");outputList.id=outputListId;if(isTrait){const link=document.createElement("a");link.href=`#${outputListHeaderId}`;link.innerText="Trait Implementations";const h=document.createElement("h3");h.appendChild(link);trait_implementations=outputList;trait_implementations_header=outputListHeader;sidebarSection.appendChild(h);sidebarTraitList=document.createElement("ul");sidebarTraitList.className="block trait-implementation";sidebarSection.appendChild(sidebarTraitList);mainContent.appendChild(outputListHeader);mainContent.appendChild(outputList)}else{implementations=outputList;if(trait_implementations){mainContent.insertBefore(outputListHeader,trait_implementations_header);mainContent.insertBefore(outputList,trait_implementations_header)}else{const mainContent=document.querySelector("#main-content");mainContent.appendChild(outputListHeader);mainContent.appendChild(outputList)}}}const template=document.createElement("template");template.innerHTML=text;onEachLazy(template.content.querySelectorAll("a"),elem=>{const href=elem.getAttribute("href");if(href&&!href.startsWith("#")&&!/^(?:[a-z+]+:)?\/\//.test(href)){elem.setAttribute("href",window.rootPath+href)}});onEachLazy(template.content.querySelectorAll("[id]"),el=>{let i=0;if(idMap.has(el.id)){i=idMap.get(el.id)}else if(document.getElementById(el.id)){i=1;while(document.getElementById(`${el.id}-${2 * i}`)){i=2*i}while(document.getElementById(`${el.id}-${i}`)){i+=1}}if(i!==0){const oldHref=`#${el.id}`;const newHref=`#${el.id}-${i}`;el.id=`${el.id}-${i}`;onEachLazy(template.content.querySelectorAll("a[href]"),link=>{if(link.getAttribute("href")===oldHref){link.href=newHref}})}idMap.set(el.id,i+1)});const templateAssocItems=template.content.querySelectorAll("section.tymethod, "+"section.method, section.associatedtype, section.associatedconstant");if(isTrait){const li=document.createElement("li");const a=document.createElement("a");a.href=`#${template.content.querySelector(".impl").id}`;a.textContent=traitName;li.appendChild(a);sidebarTraitList.append(li)}else{onEachLazy(templateAssocItems,item=>{let block=hasClass(item,"associatedtype")?associatedTypes:(hasClass(item,"associatedconstant")?associatedConstants:(methods));if(!block){const blockTitle=hasClass(item,"associatedtype")?"Associated Types":(hasClass(item,"associatedconstant")?"Associated Constants":("Methods"));const blockClass=hasClass(item,"associatedtype")?"associatedtype":(hasClass(item,"associatedconstant")?"associatedconstant":("method"));const blockHeader=document.createElement("h3");const blockLink=document.createElement("a");blockLink.href="#implementations";blockLink.innerText=blockTitle;blockHeader.appendChild(blockLink);block=document.createElement("ul");block.className=`block ${blockClass}`;const insertionReference=methods||sidebarTraitList;if(insertionReference){const insertionReferenceH=insertionReference.previousElementSibling;sidebarSection.insertBefore(blockHeader,insertionReferenceH);sidebarSection.insertBefore(block,insertionReferenceH)}else{sidebarSection.appendChild(blockHeader);sidebarSection.appendChild(block)}if(hasClass(item,"associatedtype")){associatedTypes=block}else if(hasClass(item,"associatedconstant")){associatedConstants=block}else{methods=block}}const li=document.createElement("li");const a=document.createElement("a");a.innerText=item.id.split("-")[0].split(".")[1];a.href=`#${item.id}`;li.appendChild(a);block.appendChild(li)})}outputList.appendChild(template.content)}for(const list of[methods,associatedTypes,associatedConstants,sidebarTraitList]){if(!list){continue}const newChildren=Array.prototype.slice.call(list.children);newChildren.sort((a,b)=>{const aI=a.innerText;const bI=b.innerText;return aIbI?1:0});list.replaceChildren(...newChildren)}};if(window.pending_type_impls){window.register_type_impls(window.pending_type_impls)}function addSidebarCrates(){if(!window.ALL_CRATES){return}const sidebarElems=document.getElementsByClassName("sidebar-elems")[0];if(!sidebarElems){return}const h3=document.createElement("h3");h3.innerHTML="Crates";const ul=document.createElement("ul");ul.className="block crate";for(const crate of window.ALL_CRATES){const link=document.createElement("a");link.href=window.rootPath+crate+"/index.html";link.textContent=crate;const li=document.createElement("li");if(window.rootPath!=="./"&&crate===window.currentCrate){li.className="current"}li.appendChild(link);ul.appendChild(li)}sidebarElems.appendChild(h3);sidebarElems.appendChild(ul)}function expandAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);removeClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("toggle"),e=>{if(!hasClass(e,"type-contents-toggle")&&!hasClass(e,"more-examples-toggle")){e.open=true}});innerToggle.title="collapse all docs";innerToggle.children[0].innerText="\u2212"}function collapseAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);addClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("toggle"),e=>{if(e.parentNode.id!=="implementations-list"||(!hasClass(e,"implementors-toggle")&&!hasClass(e,"type-contents-toggle"))){e.open=false}});innerToggle.title="expand all docs";innerToggle.children[0].innerText="+"}function toggleAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);if(!innerToggle){return}if(hasClass(innerToggle,"will-expand")){expandAllDocs()}else{collapseAllDocs()}}(function(){const toggles=document.getElementById(toggleAllDocsId);if(toggles){toggles.onclick=toggleAllDocs}const hideMethodDocs=getSettingValue("auto-hide-method-docs")==="true";const hideImplementations=getSettingValue("auto-hide-trait-implementations")==="true";const hideLargeItemContents=getSettingValue("auto-hide-large-items")!=="false";function setImplementorsTogglesOpen(id,open){const list=document.getElementById(id);if(list!==null){onEachLazy(list.getElementsByClassName("implementors-toggle"),e=>{e.open=open})}}if(hideImplementations){setImplementorsTogglesOpen("trait-implementations-list",false);setImplementorsTogglesOpen("blanket-implementations-list",false)}onEachLazy(document.getElementsByClassName("toggle"),e=>{if(!hideLargeItemContents&&hasClass(e,"type-contents-toggle")){e.open=true}if(hideMethodDocs&&hasClass(e,"method-toggle")){e.open=false}})}());window.rustdoc_add_line_numbers_to_examples=()=>{onEachLazy(document.getElementsByClassName("rust-example-rendered"),x=>{const parent=x.parentNode;const line_numbers=parent.querySelectorAll(".example-line-numbers");if(line_numbers.length>0){return}const count=x.textContent.split("\n").length;const elems=[];for(let i=0;i{onEachLazy(document.getElementsByClassName("rust-example-rendered"),x=>{const parent=x.parentNode;const line_numbers=parent.querySelectorAll(".example-line-numbers");for(const node of line_numbers){parent.removeChild(node)}})};if(getSettingValue("line-numbers")==="true"){window.rustdoc_add_line_numbers_to_examples()}function showSidebar(){window.hideAllModals(false);const sidebar=document.getElementsByClassName("sidebar")[0];addClass(sidebar,"shown")}function hideSidebar(){const sidebar=document.getElementsByClassName("sidebar")[0];removeClass(sidebar,"shown")}window.addEventListener("resize",()=>{if(window.CURRENT_TOOLTIP_ELEMENT){const base=window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE;const force_visible=base.TOOLTIP_FORCE_VISIBLE;hideTooltip(false);if(force_visible){showTooltip(base);base.TOOLTIP_FORCE_VISIBLE=true}}});const mainElem=document.getElementById(MAIN_ID);if(mainElem){mainElem.addEventListener("click",hideSidebar)}onEachLazy(document.querySelectorAll("a[href^='#']"),el=>{el.addEventListener("click",()=>{expandSection(el.hash.slice(1));hideSidebar()})});onEachLazy(document.querySelectorAll(".toggle > summary:not(.hideme)"),el=>{el.addEventListener("click",e=>{if(e.target.tagName!=="SUMMARY"&&e.target.tagName!=="A"){e.preventDefault()}})});function showTooltip(e){const notable_ty=e.getAttribute("data-notable-ty");if(!window.NOTABLE_TRAITS&¬able_ty){const data=document.getElementById("notable-traits-data");if(data){window.NOTABLE_TRAITS=JSON.parse(data.innerText)}else{throw new Error("showTooltip() called with notable without any notable traits!")}}if(window.CURRENT_TOOLTIP_ELEMENT&&window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE===e){clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);return}window.hideAllModals(false);const wrapper=document.createElement("div");if(notable_ty){wrapper.innerHTML="
"+window.NOTABLE_TRAITS[notable_ty]+"
"}else{if(e.getAttribute("title")!==null){e.setAttribute("data-title",e.getAttribute("title"));e.removeAttribute("title")}if(e.getAttribute("data-title")!==null){const titleContent=document.createElement("div");titleContent.className="content";titleContent.appendChild(document.createTextNode(e.getAttribute("data-title")));wrapper.appendChild(titleContent)}}wrapper.className="tooltip popover";const focusCatcher=document.createElement("div");focusCatcher.setAttribute("tabindex","0");focusCatcher.onfocus=hideTooltip;wrapper.appendChild(focusCatcher);const pos=e.getBoundingClientRect();wrapper.style.top=(pos.top+window.scrollY+pos.height)+"px";wrapper.style.left=0;wrapper.style.right="auto";wrapper.style.visibility="hidden";const body=document.getElementsByTagName("body")[0];body.appendChild(wrapper);const wrapperPos=wrapper.getBoundingClientRect();const finalPos=pos.left+window.scrollX-wrapperPos.width+24;if(finalPos>0){wrapper.style.left=finalPos+"px"}else{wrapper.style.setProperty("--popover-arrow-offset",(wrapperPos.right-pos.right+4)+"px")}wrapper.style.visibility="";window.CURRENT_TOOLTIP_ELEMENT=wrapper;window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE=e;clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);wrapper.onpointerenter=ev=>{if(ev.pointerType!=="mouse"){return}clearTooltipHoverTimeout(e)};wrapper.onpointerleave=ev=>{if(ev.pointerType!=="mouse"){return}if(!e.TOOLTIP_FORCE_VISIBLE&&!e.contains(ev.relatedTarget)){setTooltipHoverTimeout(e,false);addClass(wrapper,"fade-out")}}}function setTooltipHoverTimeout(element,show){clearTooltipHoverTimeout(element);if(!show&&!window.CURRENT_TOOLTIP_ELEMENT){return}if(show&&window.CURRENT_TOOLTIP_ELEMENT){return}if(window.CURRENT_TOOLTIP_ELEMENT&&window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE!==element){return}element.TOOLTIP_HOVER_TIMEOUT=setTimeout(()=>{if(show){showTooltip(element)}else if(!element.TOOLTIP_FORCE_VISIBLE){hideTooltip(false)}},show?window.RUSTDOC_TOOLTIP_HOVER_MS:window.RUSTDOC_TOOLTIP_HOVER_EXIT_MS)}function clearTooltipHoverTimeout(element){if(element.TOOLTIP_HOVER_TIMEOUT!==undefined){removeClass(window.CURRENT_TOOLTIP_ELEMENT,"fade-out");clearTimeout(element.TOOLTIP_HOVER_TIMEOUT);delete element.TOOLTIP_HOVER_TIMEOUT}}function tooltipBlurHandler(event){if(window.CURRENT_TOOLTIP_ELEMENT&&!window.CURRENT_TOOLTIP_ELEMENT.contains(document.activeElement)&&!window.CURRENT_TOOLTIP_ELEMENT.contains(event.relatedTarget)&&!window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.contains(document.activeElement)&&!window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.contains(event.relatedTarget)){setTimeout(()=>hideTooltip(false),0)}}function hideTooltip(focus){if(window.CURRENT_TOOLTIP_ELEMENT){if(window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.TOOLTIP_FORCE_VISIBLE){if(focus){window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.focus()}window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.TOOLTIP_FORCE_VISIBLE=false}const body=document.getElementsByTagName("body")[0];body.removeChild(window.CURRENT_TOOLTIP_ELEMENT);clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);window.CURRENT_TOOLTIP_ELEMENT=null}}onEachLazy(document.getElementsByClassName("tooltip"),e=>{e.onclick=()=>{e.TOOLTIP_FORCE_VISIBLE=e.TOOLTIP_FORCE_VISIBLE?false:true;if(window.CURRENT_TOOLTIP_ELEMENT&&!e.TOOLTIP_FORCE_VISIBLE){hideTooltip(true)}else{showTooltip(e);window.CURRENT_TOOLTIP_ELEMENT.setAttribute("tabindex","0");window.CURRENT_TOOLTIP_ELEMENT.focus();window.CURRENT_TOOLTIP_ELEMENT.onblur=tooltipBlurHandler}return false};e.onpointerenter=ev=>{if(ev.pointerType!=="mouse"){return}setTooltipHoverTimeout(e,true)};e.onpointermove=ev=>{if(ev.pointerType!=="mouse"){return}setTooltipHoverTimeout(e,true)};e.onpointerleave=ev=>{if(ev.pointerType!=="mouse"){return}if(!e.TOOLTIP_FORCE_VISIBLE&&window.CURRENT_TOOLTIP_ELEMENT&&!window.CURRENT_TOOLTIP_ELEMENT.contains(ev.relatedTarget)){setTooltipHoverTimeout(e,false);addClass(window.CURRENT_TOOLTIP_ELEMENT,"fade-out")}}});const sidebar_menu_toggle=document.getElementsByClassName("sidebar-menu-toggle")[0];if(sidebar_menu_toggle){sidebar_menu_toggle.addEventListener("click",()=>{const sidebar=document.getElementsByClassName("sidebar")[0];if(!hasClass(sidebar,"shown")){showSidebar()}else{hideSidebar()}})}function helpBlurHandler(event){blurHandler(event,getHelpButton(),window.hidePopoverMenus)}function buildHelpMenu(){const book_info=document.createElement("span");const channel=getVar("channel");book_info.className="top";book_info.innerHTML=`You can find more information in \ +the rustdoc book.`;const shortcuts=[["?","Show this help dialog"],["S","Focus the search field"],["↑","Move up in search results"],["↓","Move down in search results"],["← / →","Switch result tab (when results focused)"],["⏎","Go to active search result"],["+","Expand all sections"],["-","Collapse all sections"],].map(x=>"
"+x[0].split(" ").map((y,index)=>((index&1)===0?""+y+"":" "+y+" ")).join("")+"
"+x[1]+"
").join("");const div_shortcuts=document.createElement("div");addClass(div_shortcuts,"shortcuts");div_shortcuts.innerHTML="

Keyboard Shortcuts

"+shortcuts+"
";const infos=[`For a full list of all search features, take a look here.`,"Prefix searches with a type followed by a colon (e.g., fn:) to \ + restrict the search to a given item kind.","Accepted kinds are: fn, mod, struct, \ + enum, trait, type, macro, \ + and const.","Search functions by type signature (e.g., vec -> usize or \ + -> vec or String, enum:Cow -> bool)","You can look for items with an exact name by putting double quotes around \ + your request: \"string\"","Look for functions that accept or return \ + slices and \ + arrays by writing \ + square brackets (e.g., -> [u8] or [] -> Option)","Look for items inside another one by searching for a path: vec::Vec",].map(x=>"

"+x+"

").join("");const div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="

Search Tricks

"+infos;const rustdoc_version=document.createElement("span");rustdoc_version.className="bottom";const rustdoc_version_code=document.createElement("code");rustdoc_version_code.innerText="rustdoc "+getVar("rustdoc-version");rustdoc_version.appendChild(rustdoc_version_code);const container=document.createElement("div");if(!isHelpPage){container.className="popover"}container.id="help";container.style.display="none";const side_by_side=document.createElement("div");side_by_side.className="side-by-side";side_by_side.appendChild(div_shortcuts);side_by_side.appendChild(div_infos);container.appendChild(book_info);container.appendChild(side_by_side);container.appendChild(rustdoc_version);if(isHelpPage){const help_section=document.createElement("section");help_section.appendChild(container);document.getElementById("main-content").appendChild(help_section);container.style.display="block"}else{const help_button=getHelpButton();help_button.appendChild(container);container.onblur=helpBlurHandler;help_button.onblur=helpBlurHandler;help_button.children[0].onblur=helpBlurHandler}return container}window.hideAllModals=switchFocus=>{hideSidebar();window.hidePopoverMenus();hideTooltip(switchFocus)};window.hidePopoverMenus=()=>{onEachLazy(document.querySelectorAll(".search-form .popover"),elem=>{elem.style.display="none"})};function getHelpMenu(buildNeeded){let menu=getHelpButton().querySelector(".popover");if(!menu&&buildNeeded){menu=buildHelpMenu()}return menu}function showHelp(){getHelpButton().querySelector("a").focus();const menu=getHelpMenu(true);if(menu.style.display==="none"){window.hideAllModals();menu.style.display=""}}if(isHelpPage){showHelp();document.querySelector(`#${HELP_BUTTON_ID} > a`).addEventListener("click",event=>{const target=event.target;if(target.tagName!=="A"||target.parentElement.id!==HELP_BUTTON_ID||event.ctrlKey||event.altKey||event.metaKey){return}event.preventDefault()})}else{document.querySelector(`#${HELP_BUTTON_ID} > a`).addEventListener("click",event=>{const target=event.target;if(target.tagName!=="A"||target.parentElement.id!==HELP_BUTTON_ID||event.ctrlKey||event.altKey||event.metaKey){return}event.preventDefault();const menu=getHelpMenu(true);const shouldShowHelp=menu.style.display==="none";if(shouldShowHelp){showHelp()}else{window.hidePopoverMenus()}})}setMobileTopbar();addSidebarItems();addSidebarCrates();onHashChange(null);window.addEventListener("hashchange",onHashChange);searchState.setup()}());(function(){const SIDEBAR_MIN=100;const SIDEBAR_MAX=500;const RUSTDOC_MOBILE_BREAKPOINT=700;const BODY_MIN=400;const SIDEBAR_VANISH_THRESHOLD=SIDEBAR_MIN/2;const sidebarButton=document.getElementById("sidebar-button");if(sidebarButton){sidebarButton.addEventListener("click",e=>{removeClass(document.documentElement,"hide-sidebar");updateLocalStorage("hide-sidebar","false");if(document.querySelector(".rustdoc.src")){window.rustdocToggleSrcSidebar()}e.preventDefault()})}let currentPointerId=null;let desiredSidebarSize=null;let pendingSidebarResizingFrame=false;const resizer=document.querySelector(".sidebar-resizer");const sidebar=document.querySelector(".sidebar");if(!resizer||!sidebar){return}const isSrcPage=hasClass(document.body,"src");function hideSidebar(){if(isSrcPage){window.rustdocCloseSourceSidebar();updateLocalStorage("src-sidebar-width",null);document.documentElement.style.removeProperty("--src-sidebar-width");sidebar.style.removeProperty("--src-sidebar-width");resizer.style.removeProperty("--src-sidebar-width")}else{addClass(document.documentElement,"hide-sidebar");updateLocalStorage("hide-sidebar","true");updateLocalStorage("desktop-sidebar-width",null);document.documentElement.style.removeProperty("--desktop-sidebar-width");sidebar.style.removeProperty("--desktop-sidebar-width");resizer.style.removeProperty("--desktop-sidebar-width")}}function showSidebar(){if(isSrcPage){window.rustdocShowSourceSidebar()}else{removeClass(document.documentElement,"hide-sidebar");updateLocalStorage("hide-sidebar","false")}}function changeSidebarSize(size){if(isSrcPage){updateLocalStorage("src-sidebar-width",size);sidebar.style.setProperty("--src-sidebar-width",size+"px");resizer.style.setProperty("--src-sidebar-width",size+"px")}else{updateLocalStorage("desktop-sidebar-width",size);sidebar.style.setProperty("--desktop-sidebar-width",size+"px");resizer.style.setProperty("--desktop-sidebar-width",size+"px")}}function isSidebarHidden(){return isSrcPage?!hasClass(document.documentElement,"src-sidebar-expanded"):hasClass(document.documentElement,"hide-sidebar")}function resize(e){if(currentPointerId===null||currentPointerId!==e.pointerId){return}e.preventDefault();const pos=e.clientX-3;if(pos=SIDEBAR_MIN){if(isSidebarHidden()){showSidebar()}const constrainedPos=Math.min(pos,window.innerWidth-BODY_MIN,SIDEBAR_MAX);changeSidebarSize(constrainedPos);desiredSidebarSize=constrainedPos;if(pendingSidebarResizingFrame!==false){clearTimeout(pendingSidebarResizingFrame)}pendingSidebarResizingFrame=setTimeout(()=>{if(currentPointerId===null||pendingSidebarResizingFrame===false){return}pendingSidebarResizingFrame=false;document.documentElement.style.setProperty("--resizing-sidebar-width",desiredSidebarSize+"px")},100)}}window.addEventListener("resize",()=>{if(window.innerWidth=(window.innerWidth-BODY_MIN)){changeSidebarSize(window.innerWidth-BODY_MIN)}else if(desiredSidebarSize!==null&&desiredSidebarSize>SIDEBAR_MIN){changeSidebarSize(desiredSidebarSize)}});function stopResize(e){if(currentPointerId===null){return}if(e){e.preventDefault()}desiredSidebarSize=sidebar.getBoundingClientRect().width;removeClass(resizer,"active");window.removeEventListener("pointermove",resize,false);window.removeEventListener("pointerup",stopResize,false);removeClass(document.documentElement,"sidebar-resizing");document.documentElement.style.removeProperty("--resizing-sidebar-width");if(resizer.releasePointerCapture){resizer.releasePointerCapture(currentPointerId);currentPointerId=null}}function initResize(e){if(currentPointerId!==null||e.altKey||e.ctrlKey||e.metaKey||e.button!==0){return}if(resizer.setPointerCapture){resizer.setPointerCapture(e.pointerId);if(!resizer.hasPointerCapture(e.pointerId)){resizer.releasePointerCapture(e.pointerId);return}currentPointerId=e.pointerId}window.hideAllModals(false);e.preventDefault();window.addEventListener("pointermove",resize,false);window.addEventListener("pointercancel",stopResize,false);window.addEventListener("pointerup",stopResize,false);addClass(resizer,"active");addClass(document.documentElement,"sidebar-resizing");const pos=e.clientX-sidebar.offsetLeft-3;document.documentElement.style.setProperty("--resizing-sidebar-width",pos+"px");desiredSidebarSize=null}resizer.addEventListener("pointerdown",initResize,false)}());(function(){let reset_button_timeout=null;const but=document.getElementById("copy-path");if(!but){return}but.onclick=()=>{const parent=but.parentElement;const path=[];onEach(parent.childNodes,child=>{if(child.tagName==="A"){path.push(child.textContent)}});const el=document.createElement("textarea");el.value=path.join("::");el.setAttribute("readonly","");el.style.position="absolute";el.style.left="-9999px";document.body.appendChild(el);el.select();document.execCommand("copy");document.body.removeChild(el);but.children[0].style.display="none";let tmp;if(but.childNodes.length<2){tmp=document.createTextNode("✓");but.appendChild(tmp)}else{onEachLazy(but.childNodes,e=>{if(e.nodeType===Node.TEXT_NODE){tmp=e;return true}});tmp.textContent="✓"}if(reset_button_timeout!==null){window.clearTimeout(reset_button_timeout)}function reset_button(){tmp.textContent="";reset_button_timeout=null;but.children[0].style.display=""}reset_button_timeout=window.setTimeout(reset_button,1000)}}()) \ No newline at end of file diff --git a/docs/static.files/normalize-76eba96aa4d2e634.css b/docs/static.files/normalize-76eba96aa4d2e634.css new file mode 100644 index 00000000..469959f1 --- /dev/null +++ b/docs/static.files/normalize-76eba96aa4d2e634.css @@ -0,0 +1,2 @@ + /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ +html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type="button"],[type="reset"],[type="submit"],button{-webkit-appearance:button}[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none} \ No newline at end of file diff --git a/docs/static.files/noscript-04d5337699b92874.css b/docs/static.files/noscript-04d5337699b92874.css new file mode 100644 index 00000000..fbd55f57 --- /dev/null +++ b/docs/static.files/noscript-04d5337699b92874.css @@ -0,0 +1 @@ + #main-content .attributes{margin-left:0 !important;}#copy-path,#sidebar-button,.sidebar-resizer{display:none !important;}nav.sub{display:none;}.src .sidebar{display:none;}.notable-traits{display:none;}:root{--main-background-color:white;--main-color:black;--settings-input-color:#2196f3;--settings-input-border-color:#717171;--settings-button-color:#000;--settings-button-border-focus:#717171;--sidebar-background-color:#f5f5f5;--sidebar-background-color-hover:#e0e0e0;--code-block-background-color:#f5f5f5;--scrollbar-track-background-color:#dcdcdc;--scrollbar-thumb-background-color:rgba(36,37,39,0.6);--scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;--headings-border-bottom-color:#ddd;--border-color:#e0e0e0;--button-background-color:#fff;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:none;--mobile-sidebar-menu-filter:none;--search-input-focused-border-color:#66afe9;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(35%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ad378a;--trait-link-color:#6e4fc9;--assoc-item-link-color:#3873ad;--function-link-color:#ad7c37;--macro-link-color:#068000;--keyword-link-color:#3873ad;--mod-link-color:#3873ad;--link-color:#3873ad;--sidebar-link-color:#356da4;--sidebar-current-link-background-color:#fff;--search-result-link-focus-background-color:#ccc;--search-result-border-color:#aaa3;--search-color:#000;--search-error-code-background-color:#d0cccc;--search-results-alias-color:#000;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#e6e6e6;--search-tab-button-not-selected-background:#e6e6e6;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#fff;--stab-background-color:#fff5d6;--stab-code-color:#000;--code-highlight-kw-color:#8959a8;--code-highlight-kw-2-color:#4271ae;--code-highlight-lifetime-color:#b76514;--code-highlight-prelude-color:#4271ae;--code-highlight-prelude-val-color:#c82829;--code-highlight-number-color:#718c00;--code-highlight-string-color:#718c00;--code-highlight-literal-color:#c82829;--code-highlight-attribute-color:#c82829;--code-highlight-self-color:#c82829;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8e908c;--code-highlight-doc-comment-color:#4d4d4c;--src-line-numbers-span-color:#c67e2d;--src-line-number-highlighted-background-color:#fdffd3;--test-arrow-color:#f5f5f5;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#f5f5f5;--test-arrow-hover-background-color:rgb(78,139,202);--target-background-color:#fdffd3;--target-border-color:#ad7c37;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:initial;--crate-search-div-filter:invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg) brightness(114%) contrast(76%);--crate-search-div-hover-filter:invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg) brightness(96%) contrast(93%);--crate-search-hover-border:#717171;--src-sidebar-background-selected:#fff;--src-sidebar-background-hover:#e0e0e0;--table-alt-row-background-color:#f5f5f5;--codeblock-link-background:#eee;--scrape-example-toggle-line-background:#ccc;--scrape-example-toggle-line-hover-background:#999;--scrape-example-code-line-highlight:#fcffd6;--scrape-example-code-line-highlight-focus:#f6fdb0;--scrape-example-help-border-color:#555;--scrape-example-help-color:#333;--scrape-example-help-hover-border-color:#000;--scrape-example-help-hover-color:#000;--scrape-example-code-wrapper-background-start:rgba(255,255,255,1);--scrape-example-code-wrapper-background-end:rgba(255,255,255,0);--sidebar-resizer-hover:hsl(207,90%,66%);--sidebar-resizer-active:hsl(207,90%,54%);}@media (prefers-color-scheme:dark){:root{--main-background-color:#353535;--main-color:#ddd;--settings-input-color:#2196f3;--settings-input-border-color:#999;--settings-button-color:#000;--settings-button-border-focus:#ffb900;--sidebar-background-color:#505050;--sidebar-background-color-hover:#676767;--code-block-background-color:#2A2A2A;--scrollbar-track-background-color:#717171;--scrollbar-thumb-background-color:rgba(32,34,37,.6);--scrollbar-color:rgba(32,34,37,.6) #5a5a5a;--headings-border-bottom-color:#d2d2d2;--border-color:#e0e0e0;--button-background-color:#f0f0f0;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--mobile-sidebar-menu-filter:invert(100%);--search-input-focused-border-color:#008dfd;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(65%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#2dbfb8;--trait-link-color:#b78cf2;--assoc-item-link-color:#d2991d;--function-link-color:#2bab63;--macro-link-color:#09bd00;--keyword-link-color:#d2991d;--mod-link-color:#d2991d;--link-color:#d2991d;--sidebar-link-color:#fdbf35;--sidebar-current-link-background-color:#444;--search-result-link-focus-background-color:#616161;--search-result-border-color:#aaa3;--search-color:#111;--search-error-code-background-color:#484848;--search-results-alias-color:#fff;--search-results-grey-color:#ccc;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#252525;--search-tab-button-not-selected-background:#252525;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#353535;--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ab8ac1;--code-highlight-kw-2-color:#769acb;--code-highlight-lifetime-color:#d97f26;--code-highlight-prelude-color:#769acb;--code-highlight-prelude-val-color:#ee6868;--code-highlight-number-color:#83a300;--code-highlight-string-color:#83a300;--code-highlight-literal-color:#ee6868;--code-highlight-attribute-color:#ee6868;--code-highlight-self-color:#ee6868;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8d8d8b;--code-highlight-doc-comment-color:#8ca375;--src-line-numbers-span-color:#3b91e2;--src-line-number-highlighted-background-color:#0a042f;--test-arrow-color:#dedede;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#dedede;--test-arrow-hover-background-color:#4e8bca;--target-background-color:#494a3d;--target-border-color:#bb7410;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(94%) sepia(0%) saturate(721%) hue-rotate(255deg) brightness(90%) contrast(90%);--crate-search-div-hover-filter:invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%);--crate-search-hover-border:#2196f3;--src-sidebar-background-selected:#333;--src-sidebar-background-hover:#444;--table-alt-row-background-color:#2a2a2a;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(53,53,53,1);--scrape-example-code-wrapper-background-end:rgba(53,53,53,0);--sidebar-resizer-hover:hsl(207,30%,54%);--sidebar-resizer-active:hsl(207,90%,54%);}} \ No newline at end of file diff --git a/docs/static.files/rust-logo-151179464ae7ed46.svg b/docs/static.files/rust-logo-151179464ae7ed46.svg new file mode 100644 index 00000000..62424d8f --- /dev/null +++ b/docs/static.files/rust-logo-151179464ae7ed46.svg @@ -0,0 +1,61 @@ + + + diff --git a/docs/static.files/rustdoc-e935ef01ae1c1829.css b/docs/static.files/rustdoc-e935ef01ae1c1829.css new file mode 100644 index 00000000..37ac48cc --- /dev/null +++ b/docs/static.files/rustdoc-e935ef01ae1c1829.css @@ -0,0 +1,24 @@ + :root{--nav-sub-mobile-padding:8px;--search-typename-width:6.75rem;--desktop-sidebar-width:200px;--src-sidebar-width:300px;--desktop-sidebar-z-index:100;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:400;src:local('Fira Sans'),url("FiraSans-Regular-018c141bf0843ffd.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:500;src:local('Fira Sans Medium'),url("FiraSans-Medium-8f9a781e4970d388.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:400;src:local('Source Serif 4'),url("SourceSerif4-Regular-46f98efaafac5295.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:italic;font-weight:400;src:local('Source Serif 4 Italic'),url("SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:700;src:local('Source Serif 4 Bold'),url("SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:400;src:url("SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:italic;font-weight:400;src:url("SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:600;src:url("SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'NanumBarunGothic';src:url("NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2") format("woff2");font-display:swap;unicode-range:U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF;}*{box-sizing:border-box;}body{font:1rem/1.5 "Source Serif 4",NanumBarunGothic,serif;margin:0;position:relative;overflow-wrap:break-word;overflow-wrap:anywhere;font-feature-settings:"kern","liga";background-color:var(--main-background-color);color:var(--main-color);}h1{font-size:1.5rem;}h2{font-size:1.375rem;}h3{font-size:1.25rem;}h1,h2,h3,h4,h5,h6{font-weight:500;}h1,h2,h3,h4{margin:25px 0 15px 0;padding-bottom:6px;}.docblock h3,.docblock h4,h5,h6{margin:15px 0 5px 0;}.docblock>h2:first-child,.docblock>h3:first-child,.docblock>h4:first-child,.docblock>h5:first-child,.docblock>h6:first-child{margin-top:0;}.main-heading h1{margin:0;padding:0;flex-grow:1;overflow-wrap:break-word;overflow-wrap:anywhere;}.main-heading{display:flex;flex-wrap:wrap;padding-bottom:6px;margin-bottom:15px;}.content h2,.top-doc .docblock>h3,.top-doc .docblock>h4{border-bottom:1px solid var(--headings-border-bottom-color);}h1,h2{line-height:1.25;padding-top:3px;padding-bottom:9px;}h3.code-header{font-size:1.125rem;}h4.code-header{font-size:1rem;}.code-header{font-weight:600;margin:0;padding:0;white-space:pre-wrap;}#crate-search,h1,h2,h3,h4,h5,h6,.sidebar,.mobile-topbar,.search-input,.search-results .result-name,.item-name>a,.out-of-band,span.since,a.src,#help-button>a,summary.hideme,.scraped-example-list,ul.all-items{font-family:"Fira Sans",Arial,NanumBarunGothic,sans-serif;}#toggle-all-docs,a.anchor,.section-header a,#src-sidebar a,.rust a,.sidebar h2 a,.sidebar h3 a,.mobile-topbar h2 a,h1 a,.search-results a,.stab,.result-name i{color:var(--main-color);}span.enum,a.enum,span.struct,a.struct,span.union,a.union,span.primitive,a.primitive,span.type,a.type,span.foreigntype,a.foreigntype{color:var(--type-link-color);}span.trait,a.trait,span.traitalias,a.traitalias{color:var(--trait-link-color);}span.associatedtype,a.associatedtype,span.constant,a.constant,span.static,a.static{color:var(--assoc-item-link-color);}span.fn,a.fn,span.method,a.method,span.tymethod,a.tymethod{color:var(--function-link-color);}span.attr,a.attr,span.derive,a.derive,span.macro,a.macro{color:var(--macro-link-color);}span.mod,a.mod{color:var(--mod-link-color);}span.keyword,a.keyword{color:var(--keyword-link-color);}a{color:var(--link-color);text-decoration:none;}ol,ul{padding-left:24px;}ul ul,ol ul,ul ol,ol ol{margin-bottom:.625em;}p,.docblock>.warning{margin:0 0 .75em 0;}p:last-child,.docblock>.warning:last-child{margin:0;}button{padding:1px 6px;cursor:pointer;}button#toggle-all-docs{padding:0;background:none;border:none;-webkit-appearance:none;opacity:1;}.rustdoc{display:flex;flex-direction:row;flex-wrap:nowrap;}main{position:relative;flex-grow:1;padding:10px 15px 40px 45px;min-width:0;}.src main{padding:15px;}.width-limiter{max-width:960px;margin-right:auto;}details:not(.toggle) summary{margin-bottom:.6em;}code,pre,a.test-arrow,.code-header{font-family:"Source Code Pro",monospace;}.docblock code,.docblock-short code{border-radius:3px;padding:0 0.125em;}.docblock pre code,.docblock-short pre code{padding:0;}pre{padding:14px;line-height:1.5;}pre.item-decl{overflow-x:auto;}.item-decl .type-contents-toggle{contain:initial;}.src .content pre{padding:20px;}.rustdoc.src .example-wrap pre.src-line-numbers{padding:20px 0 20px 4px;}img{max-width:100%;}.logo-container{line-height:0;display:block;}.rust-logo{filter:var(--rust-logo-filter);}.sidebar{font-size:0.875rem;flex:0 0 var(--desktop-sidebar-width);width:var(--desktop-sidebar-width);overflow-y:scroll;overscroll-behavior:contain;position:sticky;height:100vh;top:0;left:0;z-index:var(--desktop-sidebar-z-index);}.rustdoc.src .sidebar{flex-basis:50px;width:50px;border-right:1px solid;overflow-x:hidden;overflow-y:hidden;}.hide-sidebar .sidebar,.hide-sidebar .sidebar-resizer{display:none;}.sidebar-resizer{touch-action:none;width:9px;cursor:col-resize;z-index:calc(var(--desktop-sidebar-z-index) + 1);position:fixed;height:100%;left:calc(var(--desktop-sidebar-width) + 1px);}.rustdoc.src .sidebar-resizer{left:49px;}.src-sidebar-expanded .src .sidebar-resizer{left:var(--src-sidebar-width);}.sidebar-resizing{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;}.sidebar-resizing*{cursor:col-resize !important;}.sidebar-resizing .sidebar{position:fixed;}.sidebar-resizing>body{padding-left:var(--resizing-sidebar-width);}.sidebar-resizer:hover,.sidebar-resizer:active,.sidebar-resizer:focus,.sidebar-resizer.active{width:10px;margin:0;left:var(--desktop-sidebar-width);border-left:solid 1px var(--sidebar-resizer-hover);}.src-sidebar-expanded .rustdoc.src .sidebar-resizer:hover,.src-sidebar-expanded .rustdoc.src .sidebar-resizer:active,.src-sidebar-expanded .rustdoc.src .sidebar-resizer:focus,.src-sidebar-expanded .rustdoc.src .sidebar-resizer.active{left:calc(var(--src-sidebar-width) - 1px);}@media (pointer:coarse){.sidebar-resizer{display:none !important;}}.sidebar-resizer.active{padding:0 140px;width:2px;margin-left:-140px;border-left:none;}.sidebar-resizer.active:before{border-left:solid 2px var(--sidebar-resizer-active);display:block;height:100%;content:"";}.sidebar,.mobile-topbar,.sidebar-menu-toggle,#src-sidebar{background-color:var(--sidebar-background-color);}.src .sidebar>*{visibility:hidden;}.src-sidebar-expanded .src .sidebar{overflow-y:auto;flex-basis:var(--src-sidebar-width);width:var(--src-sidebar-width);}.src-sidebar-expanded .src .sidebar>*{visibility:visible;}#all-types{margin-top:1em;}*{scrollbar-width:initial;scrollbar-color:var(--scrollbar-color);}.sidebar{scrollbar-width:thin;scrollbar-color:var(--scrollbar-color);}::-webkit-scrollbar{width:12px;}.sidebar::-webkit-scrollbar{width:8px;}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0;background-color:var(--scrollbar-track-background-color);}.sidebar::-webkit-scrollbar-track{background-color:var(--scrollbar-track-background-color);}::-webkit-scrollbar-thumb,.sidebar::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb-background-color);}.hidden{display:none !important;}.logo-container>img{height:48px;width:48px;}ul.block,.block li{padding:0;margin:0;list-style:none;}.sidebar-elems a,.sidebar>h2 a{display:block;padding:0.25rem;margin-left:-0.25rem;margin-right:0.25rem;}.sidebar h2{overflow-wrap:anywhere;padding:0;margin:0.7rem 0;}.sidebar h3{font-size:1.125rem;padding:0;margin:0;}.sidebar-elems,.sidebar>.version,.sidebar>h2{padding-left:24px;}.sidebar a{color:var(--sidebar-link-color);}.sidebar .current,.sidebar .current a,.sidebar-crate a.logo-container:hover+h2 a,.sidebar a:hover:not(.logo-container){background-color:var(--sidebar-current-link-background-color);}.sidebar-elems .block{margin-bottom:2em;}.sidebar-elems .block li a{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;}.sidebar-crate{display:flex;align-items:center;justify-content:center;margin:14px 32px 1rem;row-gap:10px;column-gap:32px;flex-wrap:wrap;}.sidebar-crate h2{flex-grow:1;margin:0 -8px;align-self:start;}.sidebar-crate .logo-container{margin:0 -16px 0 -16px;text-align:center;}.sidebar-crate h2 a{display:block;margin:0 calc(-24px + 0.25rem) 0 -0.2rem;padding:calc((16px - 0.57rem ) / 2 ) 0.25rem;padding-left:0.2rem;}.sidebar-crate h2 .version{display:block;font-weight:normal;font-size:1rem;overflow-wrap:break-word;}.sidebar-crate+.version{margin-top:-1rem;margin-bottom:1rem;}.mobile-topbar{display:none;}.rustdoc .example-wrap{display:flex;position:relative;margin-bottom:10px;}.rustdoc .example-wrap:last-child{margin-bottom:0px;}.rustdoc .example-wrap pre{margin:0;flex-grow:1;}.rustdoc:not(.src) .example-wrap pre{overflow:auto hidden;}.rustdoc .example-wrap pre.example-line-numbers,.rustdoc .example-wrap pre.src-line-numbers{flex-grow:0;min-width:fit-content;overflow:initial;text-align:right;-webkit-user-select:none;user-select:none;padding:14px 8px;color:var(--src-line-numbers-span-color);}.rustdoc .example-wrap pre.src-line-numbers{padding:14px 0;}.src-line-numbers a,.src-line-numbers span{color:var(--src-line-numbers-span-color);padding:0 8px;}.src-line-numbers :target{background-color:transparent;border-right:none;padding:0 8px;}.src-line-numbers .line-highlighted{background-color:var(--src-line-number-highlighted-background-color);}.search-loading{text-align:center;}.docblock-short{overflow-wrap:break-word;overflow-wrap:anywhere;}.docblock :not(pre)>code,.docblock-short code{white-space:pre-wrap;}.top-doc .docblock h2{font-size:1.375rem;}.top-doc .docblock h3{font-size:1.25rem;}.top-doc .docblock h4,.top-doc .docblock h5{font-size:1.125rem;}.top-doc .docblock h6{font-size:1rem;}.docblock h5{font-size:1rem;}.docblock h6{font-size:0.875rem;}.docblock{margin-left:24px;position:relative;}.docblock>:not(.more-examples-toggle):not(.example-wrap){max-width:100%;overflow-x:auto;}.out-of-band{flex-grow:0;font-size:1.125rem;}.docblock code,.docblock-short code,pre,.rustdoc.src .example-wrap{background-color:var(--code-block-background-color);}#main-content{position:relative;}.docblock table{margin:.5em 0;border-collapse:collapse;}.docblock table td,.docblock table th{padding:.5em;border:1px solid var(--border-color);}.docblock table tbody tr:nth-child(2n){background:var(--table-alt-row-background-color);}div.where{white-space:pre-wrap;font-size:0.875rem;}.item-info{display:block;margin-left:24px;}.item-info code{font-size:0.875rem;}#main-content>.item-info{margin-left:0;}nav.sub{flex-grow:1;flex-flow:row nowrap;margin:4px 0 25px 0;display:flex;align-items:center;}.search-form{position:relative;display:flex;height:34px;flex-grow:1;}.src nav.sub{margin:0 0 15px 0;}.section-header{display:block;position:relative;}.section-header:hover>.anchor,.impl:hover>.anchor,.trait-impl:hover>.anchor,.variant:hover>.anchor{display:initial;}.anchor{display:none;position:absolute;left:-0.5em;background:none !important;}.anchor.field{left:-5px;}.section-header>.anchor{left:-15px;padding-right:8px;}h2.section-header>.anchor{padding-right:6px;}a.doc-anchor{color:var(--main-color);display:none;position:absolute;left:-17px;padding-right:5px;padding-left:3px;}*:hover>.doc-anchor{display:block;}.top-doc>.docblock>*:first-child>.doc-anchor{display:none !important;}.main-heading a:hover,.example-wrap .rust a:hover,.all-items a:hover,.docblock a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover:not(.doc-anchor),.docblock-short a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover,.item-info a{text-decoration:underline;}.crate.block li.current a{font-weight:500;}table,.item-table{overflow-wrap:break-word;}.item-table{display:table;padding:0;margin:0;}.item-table>li{display:table-row;}.item-table>li>div{display:table-cell;}.item-table>li>.item-name{padding-right:1.25rem;}.search-results-title{margin-top:0;white-space:nowrap;display:flex;align-items:baseline;}#crate-search-div{position:relative;min-width:5em;}#crate-search{min-width:115px;padding:0 23px 0 4px;max-width:100%;text-overflow:ellipsis;border:1px solid var(--border-color);border-radius:4px;outline:none;cursor:pointer;-moz-appearance:none;-webkit-appearance:none;text-indent:0.01px;background-color:var(--main-background-color);color:inherit;line-height:1.5;font-weight:500;}#crate-search:hover,#crate-search:focus{border-color:var(--crate-search-hover-border);}#crate-search-div::after{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0;content:"";background-repeat:no-repeat;background-size:20px;background-position:calc(100% - 2px) 56%;background-image:url('data:image/svg+xml, \ + ');filter:var(--crate-search-div-filter);}#crate-search-div:hover::after,#crate-search-div:focus-within::after{filter:var(--crate-search-div-hover-filter);}#crate-search>option{font-size:1rem;}.search-input{-webkit-appearance:none;outline:none;border:1px solid var(--border-color);border-radius:2px;padding:8px;font-size:1rem;flex-grow:1;background-color:var(--button-background-color);color:var(--search-color);}.search-input:focus{border-color:var(--search-input-focused-border-color);}.search-results{display:none;}.search-results.active{display:block;}.search-results>a{display:flex;margin-left:2px;margin-right:2px;border-bottom:1px solid var(--search-result-border-color);gap:1em;}.search-results>a>div.desc{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;flex:2;}.search-results a:hover,.search-results a:focus{background-color:var(--search-result-link-focus-background-color);}.search-results .result-name{display:flex;align-items:center;justify-content:start;flex:3;}.search-results .result-name .alias{color:var(--search-results-alias-color);}.search-results .result-name .grey{color:var(--search-results-grey-color);}.search-results .result-name .typename{color:var(--search-results-grey-color);font-size:0.875rem;width:var(--search-typename-width);}.search-results .result-name .path{word-break:break-all;max-width:calc(100% - var(--search-typename-width));display:inline-block;}.search-results .result-name .path>*{display:inline;}.popover{position:absolute;top:100%;right:0;z-index:calc(var(--desktop-sidebar-z-index) + 1);margin-top:7px;border-radius:3px;border:1px solid var(--border-color);background-color:var(--main-background-color);color:var(--main-color);--popover-arrow-offset:11px;}.popover::before{content:'';position:absolute;right:var(--popover-arrow-offset);border:solid var(--border-color);border-width:1px 1px 0 0;background-color:var(--main-background-color);padding:4px;transform:rotate(-45deg);top:-5px;}.setting-line{margin:1.2em 0.6em;}.setting-radio input,.setting-check input{margin-right:0.3em;height:1.2rem;width:1.2rem;border:2px solid var(--settings-input-border-color);outline:none;-webkit-appearance:none;cursor:pointer;}.setting-radio input{border-radius:50%;}.setting-radio span,.setting-check span{padding-bottom:1px;}.setting-radio{margin-top:0.1em;margin-bottom:0.1em;min-width:3.8em;padding:0.3em;display:inline-flex;align-items:center;cursor:pointer;}.setting-radio+.setting-radio{margin-left:0.5em;}.setting-check{margin-right:20px;display:flex;align-items:center;cursor:pointer;}.setting-radio input:checked{box-shadow:inset 0 0 0 3px var(--main-background-color);background-color:var(--settings-input-color);}.setting-check input:checked{background-color:var(--settings-input-color);border-width:1px;content:url('data:image/svg+xml,\ + \ + ');}.setting-radio input:focus,.setting-check input:focus{box-shadow:0 0 1px 1px var(--settings-input-color);}.setting-radio input:checked:focus{box-shadow:inset 0 0 0 3px var(--main-background-color),0 0 2px 2px var(--settings-input-color);}.setting-radio input:hover,.setting-check input:hover{border-color:var(--settings-input-color) !important;}#help.popover{max-width:600px;--popover-arrow-offset:48px;}#help dt{float:left;clear:left;margin-right:0.5rem;}#help span.top,#help span.bottom{text-align:center;display:block;font-size:1.125rem;}#help span.top{margin:10px 0;border-bottom:1px solid var(--border-color);padding-bottom:4px;margin-bottom:6px;}#help span.bottom{clear:both;border-top:1px solid var(--border-color);}.side-by-side>div{width:50%;float:left;padding:0 20px 20px 17px;}.item-info .stab{display:block;padding:3px;margin-bottom:5px;}.item-name .stab{margin-left:0.3125em;}.stab{padding:0 2px;font-size:0.875rem;font-weight:normal;color:var(--main-color);background-color:var(--stab-background-color);width:fit-content;white-space:pre-wrap;border-radius:3px;display:inline;vertical-align:baseline;}.stab.portability>code{background:none;color:var(--stab-code-color);}.stab .emoji,.item-info .stab::before{font-size:1.25rem;}.stab .emoji{margin-right:0.3rem;}.item-info .stab::before{content:"\0";width:0;display:inline-block;color:transparent;}.emoji{text-shadow:1px 0 0 black,-1px 0 0 black,0 1px 0 black,0 -1px 0 black;}.since{font-weight:normal;font-size:initial;}.rightside{padding-left:12px;float:right;}.rightside:not(a),.out-of-band{color:var(--right-side-color);}pre.rust{tab-size:4;-moz-tab-size:4;}pre.rust .kw{color:var(--code-highlight-kw-color);}pre.rust .kw-2{color:var(--code-highlight-kw-2-color);}pre.rust .lifetime{color:var(--code-highlight-lifetime-color);}pre.rust .prelude-ty{color:var(--code-highlight-prelude-color);}pre.rust .prelude-val{color:var(--code-highlight-prelude-val-color);}pre.rust .string{color:var(--code-highlight-string-color);}pre.rust .number{color:var(--code-highlight-number-color);}pre.rust .bool-val{color:var(--code-highlight-literal-color);}pre.rust .self{color:var(--code-highlight-self-color);}pre.rust .attr{color:var(--code-highlight-attribute-color);}pre.rust .macro,pre.rust .macro-nonterminal{color:var(--code-highlight-macro-color);}pre.rust .question-mark{font-weight:bold;color:var(--code-highlight-question-mark-color);}pre.rust .comment{color:var(--code-highlight-comment-color);}pre.rust .doccomment{color:var(--code-highlight-doc-comment-color);}.rustdoc.src .example-wrap pre.rust a{background:var(--codeblock-link-background);}.example-wrap.compile_fail,.example-wrap.should_panic{border-left:2px solid var(--codeblock-error-color);}.ignore.example-wrap{border-left:2px solid var(--codeblock-ignore-color);}.example-wrap.compile_fail:hover,.example-wrap.should_panic:hover{border-left:2px solid var(--codeblock-error-hover-color);}.example-wrap.ignore:hover{border-left:2px solid var(--codeblock-ignore-hover-color);}.example-wrap.compile_fail .tooltip,.example-wrap.should_panic .tooltip{color:var(--codeblock-error-color);}.example-wrap.ignore .tooltip{color:var(--codeblock-ignore-color);}.example-wrap.compile_fail:hover .tooltip,.example-wrap.should_panic:hover .tooltip{color:var(--codeblock-error-hover-color);}.example-wrap.ignore:hover .tooltip{color:var(--codeblock-ignore-hover-color);}.example-wrap .tooltip{position:absolute;display:block;left:-25px;top:5px;margin:0;line-height:1;}.example-wrap.compile_fail .tooltip,.example-wrap.should_panic .tooltip,.example-wrap.ignore .tooltip{font-weight:bold;font-size:1.25rem;}.content .docblock .warning{border-left:2px solid var(--warning-border-color);padding:14px;position:relative;overflow-x:visible !important;}.content .docblock .warning::before{color:var(--warning-border-color);content:"ⓘ";position:absolute;left:-25px;top:5px;font-weight:bold;font-size:1.25rem;}.top-doc>.docblock>.warning:first-child::before{top:20px;}a.test-arrow{visibility:hidden;position:absolute;padding:5px 10px 5px 10px;border-radius:5px;font-size:1.375rem;top:5px;right:5px;z-index:1;color:var(--test-arrow-color);background-color:var(--test-arrow-background-color);}a.test-arrow:hover{color:var(--test-arrow-hover-color);background-color:var(--test-arrow-hover-background-color);}.example-wrap:hover .test-arrow{visibility:visible;}.code-attribute{font-weight:300;color:var(--code-attribute-color);}.item-spacer{width:100%;height:12px;display:block;}.out-of-band>span.since{font-size:1.25rem;}.sub-variant h4{font-size:1rem;font-weight:400;margin-top:0;margin-bottom:0;}.sub-variant{margin-left:24px;margin-bottom:40px;}.sub-variant>.sub-variant-field{margin-left:24px;}:target{padding-right:3px;background-color:var(--target-background-color);border-right:3px solid var(--target-border-color);}.code-header a.tooltip{color:inherit;margin-right:15px;position:relative;}.code-header a.tooltip:hover{color:var(--link-color);}a.tooltip:hover::after{position:absolute;top:calc(100% - 10px);left:-15px;right:-15px;height:20px;content:"\00a0";}.fade-out{opacity:0;transition:opacity 0.45s cubic-bezier(0,0,0.1,1.0);}.popover.tooltip .content{margin:0.25em 0.5em;}.popover.tooltip .content pre,.popover.tooltip .content code{background:transparent;margin:0;padding:0;font-size:1.25rem;white-space:pre-wrap;}.popover.tooltip .content>h3:first-child{margin:0 0 5px 0;}.search-failed{text-align:center;margin-top:20px;display:none;}.search-failed.active{display:block;}.search-failed>ul{text-align:left;max-width:570px;margin-left:auto;margin-right:auto;}#search-tabs{display:flex;flex-direction:row;gap:1px;margin-bottom:4px;}#search-tabs button{text-align:center;font-size:1.125rem;border:0;border-top:2px solid;flex:1;line-height:1.5;color:inherit;}#search-tabs button:not(.selected){background-color:var(--search-tab-button-not-selected-background);border-top-color:var(--search-tab-button-not-selected-border-top-color);}#search-tabs button:hover,#search-tabs button.selected{background-color:var(--search-tab-button-selected-background);border-top-color:var(--search-tab-button-selected-border-top-color);}#search-tabs .count{font-size:1rem;font-variant-numeric:tabular-nums;color:var(--search-tab-title-count-color);}#search .error code{border-radius:3px;background-color:var(--search-error-code-background-color);}.search-corrections{font-weight:normal;}#src-sidebar{width:100%;overflow:auto;}#src-sidebar div.files>a:hover,details.dir-entry summary:hover,#src-sidebar div.files>a:focus,details.dir-entry summary:focus{background-color:var(--src-sidebar-background-hover);}#src-sidebar div.files>a.selected{background-color:var(--src-sidebar-background-selected);}.src-sidebar-title{position:sticky;top:0;display:flex;padding:8px 8px 0 48px;margin-bottom:7px;background:var(--sidebar-background-color);border-bottom:1px solid var(--border-color);}#settings-menu,#help-button{margin-left:4px;display:flex;}#sidebar-button{display:none;line-height:0;}.hide-sidebar #sidebar-button,.src #sidebar-button{display:flex;margin-right:4px;position:fixed;left:6px;height:34px;width:34px;background-color:var(--main-background-color);z-index:1;}.src #sidebar-button{left:8px;z-index:calc(var(--desktop-sidebar-z-index) + 1);}.hide-sidebar .src #sidebar-button{position:static;}#settings-menu>a,#help-button>a,#sidebar-button>a{display:flex;align-items:center;justify-content:center;background-color:var(--button-background-color);border:1px solid var(--border-color);border-radius:2px;color:var(--settings-button-color);font-size:20px;width:33px;}#settings-menu>a:hover,#settings-menu>a:focus,#help-button>a:hover,#help-button>a:focus,#sidebar-button>a:hover,#sidebar-button>a:focus{border-color:var(--settings-button-border-focus);}#sidebar-button>a:before{content:url('data:image/svg+xml,\ + \ + \ + ');width:22px;height:22px;}#copy-path{color:var(--copy-path-button-color);background:var(--main-background-color);height:34px;margin-left:10px;padding:0;padding-left:2px;border:0;width:33px;}#copy-path>img{filter:var(--copy-path-img-filter);}#copy-path:hover>img{filter:var(--copy-path-img-hover-filter);}@keyframes rotating{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}#settings-menu.rotate>a img{animation:rotating 2s linear infinite;}kbd{display:inline-block;padding:3px 5px;font:15px monospace;line-height:10px;vertical-align:middle;border:solid 1px var(--border-color);border-radius:3px;color:var(--kbd-color);background-color:var(--kbd-background);box-shadow:inset 0 -1px 0 var(--kbd-box-shadow-color);}ul.all-items>li{list-style:none;}details.dir-entry{padding-left:4px;}details.dir-entry>summary{margin:0 0 0 -4px;padding:0 0 0 4px;cursor:pointer;}details.dir-entry div.folders,details.dir-entry div.files{padding-left:23px;}details.dir-entry a{display:block;}details.toggle{contain:layout;position:relative;}details.toggle>summary.hideme{cursor:pointer;font-size:1rem;}details.toggle>summary{list-style:none;outline:none;}details.toggle>summary::-webkit-details-marker,details.toggle>summary::marker{display:none;}details.toggle>summary.hideme>span{margin-left:9px;}details.toggle>summary::before{background:url('data:image/svg+xml,') no-repeat top left;content:"";cursor:pointer;width:16px;height:16px;display:inline-block;vertical-align:middle;opacity:.5;filter:var(--toggle-filter);}details.toggle>summary.hideme>span,.more-examples-toggle summary,.more-examples-toggle .hide-more{color:var(--toggles-color);}details.toggle>summary::after{content:"Expand";overflow:hidden;width:0;height:0;position:absolute;}details.toggle>summary.hideme::after{content:"";}details.toggle>summary:focus::before,details.toggle>summary:hover::before{opacity:1;}details.toggle>summary:focus-visible::before{outline:1px dotted #000;outline-offset:1px;}details.non-exhaustive{margin-bottom:8px;}details.toggle>summary.hideme::before{position:relative;}details.toggle>summary:not(.hideme)::before{position:absolute;left:-24px;top:4px;}.impl-items>details.toggle>summary:not(.hideme)::before{position:absolute;left:-24px;}details.toggle[open] >summary.hideme{position:absolute;}details.toggle[open] >summary.hideme>span{display:none;}details.toggle[open] >summary::before{background:url('data:image/svg+xml,') no-repeat top left;}details.toggle[open] >summary::after{content:"Collapse";}.docblock summary>*{display:inline-block;}.docblock>.example-wrap:first-child .tooltip{margin-top:16px;}.src #sidebar-button>a:before,.sidebar-menu-toggle:before{content:url('data:image/svg+xml,\ + ');opacity:0.75;}.sidebar-menu-toggle:hover:before,.sidebar-menu-toggle:active:before,.sidebar-menu-toggle:focus:before{opacity:1;}.src #sidebar-button>a:before{content:url('data:image/svg+xml,\ + \ + \ + ');opacity:0.75;}@media (max-width:850px){#search-tabs .count{display:block;}}@media (max-width:700px){*[id]{scroll-margin-top:45px;}.rustdoc{display:block;}main{padding-left:15px;padding-top:0px;}.main-heading{flex-direction:column;}.out-of-band{text-align:left;margin-left:initial;padding:initial;}.out-of-band .since::before{content:"Since ";}.sidebar .logo-container,.sidebar .location,.sidebar-resizer{display:none;}.sidebar{position:fixed;top:45px;left:-1000px;z-index:11;height:calc(100vh - 45px);width:200px;}.src main,.rustdoc.src .sidebar{top:0;padding:0;height:100vh;border:0;}.src .search-form{margin-left:40px;}.hide-sidebar .search-form{margin-left:32px;}.hide-sidebar .src .search-form{margin-left:0;}.sidebar.shown,.src-sidebar-expanded .src .sidebar,.rustdoc:not(.src) .sidebar:focus-within{left:0;}.mobile-topbar h2{padding-bottom:0;margin:auto 0.5em auto auto;overflow:hidden;font-size:24px;white-space:nowrap;text-overflow:ellipsis;}.mobile-topbar .logo-container>img{max-width:35px;max-height:35px;margin:5px 0 5px 20px;}.mobile-topbar{display:flex;flex-direction:row;position:sticky;z-index:10;font-size:2rem;height:45px;width:100%;left:0;top:0;}.hide-sidebar .mobile-topbar{display:none;}.sidebar-menu-toggle{width:45px;border:none;line-height:0;}.hide-sidebar .sidebar-menu-toggle{display:none;}.sidebar-elems{margin-top:1em;}.anchor{display:none !important;}#main-content>details.toggle>summary::before,#main-content>div>details.toggle>summary::before{left:-11px;}#copy-path,#help-button{display:none;}#sidebar-button>a:before{content:url('data:image/svg+xml,\ + \ + \ + ');width:22px;height:22px;}.sidebar-menu-toggle:before{filter:var(--mobile-sidebar-menu-filter);}.sidebar-menu-toggle:hover{background:var(--main-background-color);}.item-table,.item-row,.item-table>li,.item-table>li>div,.search-results>a,.search-results>a>div{display:block;}.search-results>a{padding:5px 0px;}.search-results>a>div.desc,.item-table>li>div.desc{padding-left:2em;}.search-results .result-name{display:block;}.search-results .result-name .typename{width:initial;margin-right:0;}.search-results .result-name .typename,.search-results .result-name .path{display:inline;}.src-sidebar-expanded .src .sidebar{position:fixed;max-width:100vw;width:100vw;}.src .src-sidebar-title{padding-top:0;}details.toggle:not(.top-doc)>summary{margin-left:10px;}.impl-items>details.toggle>summary:not(.hideme)::before,#main-content>details.toggle:not(.top-doc)>summary::before,#main-content>div>details.toggle>summary::before{left:-11px;}.impl-items>.item-info{margin-left:34px;}.src nav.sub{margin:0;padding:var(--nav-sub-mobile-padding);}}@media (min-width:701px){.scraped-example-title{position:absolute;z-index:10;background:var(--main-background-color);bottom:8px;right:5px;padding:2px 4px;box-shadow:0 0 4px var(--main-background-color);}}@media print{nav.sidebar,nav.sub,.out-of-band,a.src,#copy-path,details.toggle[open] >summary::before,details.toggle>summary::before,details.toggle.top-doc>summary{display:none;}.docblock{margin-left:0;}main{padding:10px;}}@media (max-width:464px){.docblock{margin-left:12px;}.docblock code{overflow-wrap:break-word;overflow-wrap:anywhere;}nav.sub{flex-direction:column;}.search-form{align-self:stretch;}}.variant,.implementors-toggle>summary,.impl,#implementors-list>.docblock,.impl-items>section,.impl-items>.toggle>summary,.methods>section,.methods>.toggle>summary{margin-bottom:0.75em;}.variants>.docblock,.implementors-toggle>.docblock,.impl-items>.toggle[open]:not(:last-child),.methods>.toggle[open]:not(:last-child),.implementors-toggle[open]:not(:last-child){margin-bottom:2em;}#trait-implementations-list .impl-items>.toggle:not(:last-child),#synthetic-implementations-list .impl-items>.toggle:not(:last-child),#blanket-implementations-list .impl-items>.toggle:not(:last-child){margin-bottom:1em;}.scraped-example-list .scrape-help{margin-left:10px;padding:0 4px;font-weight:normal;font-size:12px;position:relative;bottom:1px;border:1px solid var(--scrape-example-help-border-color);border-radius:50px;color:var(--scrape-example-help-color);}.scraped-example-list .scrape-help:hover{border-color:var(--scrape-example-help-hover-border-color);color:var(--scrape-example-help-hover-color);}.scraped-example{position:relative;}.scraped-example .code-wrapper{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;width:100%;}.scraped-example:not(.expanded) .code-wrapper{max-height:calc(1.5em * 5 + 10px);}.scraped-example:not(.expanded) .code-wrapper pre{overflow-y:hidden;padding-bottom:0;max-height:calc(1.5em * 5 + 10px);}.more-scraped-examples .scraped-example:not(.expanded) .code-wrapper,.more-scraped-examples .scraped-example:not(.expanded) .code-wrapper pre{max-height:calc(1.5em * 10 + 10px);}.scraped-example .code-wrapper .next,.scraped-example .code-wrapper .prev,.scraped-example .code-wrapper .expand{color:var(--main-color);position:absolute;top:0.25em;z-index:1;padding:0;background:none;border:none;-webkit-appearance:none;opacity:1;}.scraped-example .code-wrapper .prev{right:2.25em;}.scraped-example .code-wrapper .next{right:1.25em;}.scraped-example .code-wrapper .expand{right:0.25em;}.scraped-example:not(.expanded) .code-wrapper::before,.scraped-example:not(.expanded) .code-wrapper::after{content:" ";width:100%;height:5px;position:absolute;z-index:1;}.scraped-example:not(.expanded) .code-wrapper::before{top:0;background:linear-gradient(to bottom,var(--scrape-example-code-wrapper-background-start),var(--scrape-example-code-wrapper-background-end));}.scraped-example:not(.expanded) .code-wrapper::after{bottom:0;background:linear-gradient(to top,var(--scrape-example-code-wrapper-background-start),var(--scrape-example-code-wrapper-background-end));}.scraped-example .code-wrapper .example-wrap{width:100%;overflow-y:hidden;margin-bottom:0;}.scraped-example:not(.expanded) .code-wrapper .example-wrap{overflow-x:hidden;}.scraped-example .example-wrap .rust span.highlight{background:var(--scrape-example-code-line-highlight);}.scraped-example .example-wrap .rust span.highlight.focus{background:var(--scrape-example-code-line-highlight-focus);}.more-examples-toggle{max-width:calc(100% + 25px);margin-top:10px;margin-left:-25px;}.more-examples-toggle .hide-more{margin-left:25px;cursor:pointer;}.more-scraped-examples{margin-left:25px;position:relative;}.toggle-line{position:absolute;top:5px;bottom:0;right:calc(100% + 10px);padding:0 4px;cursor:pointer;}.toggle-line-inner{min-width:2px;height:100%;background:var(--scrape-example-toggle-line-background);}.toggle-line:hover .toggle-line-inner{background:var(--scrape-example-toggle-line-hover-background);}.more-scraped-examples .scraped-example,.example-links{margin-top:20px;}.more-scraped-examples .scraped-example:first-child{margin-top:5px;}.example-links ul{margin-bottom:0;}:root[data-theme="light"]{--main-background-color:white;--main-color:black;--settings-input-color:#2196f3;--settings-input-border-color:#717171;--settings-button-color:#000;--settings-button-border-focus:#717171;--sidebar-background-color:#f5f5f5;--sidebar-background-color-hover:#e0e0e0;--code-block-background-color:#f5f5f5;--scrollbar-track-background-color:#dcdcdc;--scrollbar-thumb-background-color:rgba(36,37,39,0.6);--scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;--headings-border-bottom-color:#ddd;--border-color:#e0e0e0;--button-background-color:#fff;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:none;--mobile-sidebar-menu-filter:none;--search-input-focused-border-color:#66afe9;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(35%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ad378a;--trait-link-color:#6e4fc9;--assoc-item-link-color:#3873ad;--function-link-color:#ad7c37;--macro-link-color:#068000;--keyword-link-color:#3873ad;--mod-link-color:#3873ad;--link-color:#3873ad;--sidebar-link-color:#356da4;--sidebar-current-link-background-color:#fff;--search-result-link-focus-background-color:#ccc;--search-result-border-color:#aaa3;--search-color:#000;--search-error-code-background-color:#d0cccc;--search-results-alias-color:#000;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#e6e6e6;--search-tab-button-not-selected-background:#e6e6e6;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#fff;--stab-background-color:#fff5d6;--stab-code-color:#000;--code-highlight-kw-color:#8959a8;--code-highlight-kw-2-color:#4271ae;--code-highlight-lifetime-color:#b76514;--code-highlight-prelude-color:#4271ae;--code-highlight-prelude-val-color:#c82829;--code-highlight-number-color:#718c00;--code-highlight-string-color:#718c00;--code-highlight-literal-color:#c82829;--code-highlight-attribute-color:#c82829;--code-highlight-self-color:#c82829;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8e908c;--code-highlight-doc-comment-color:#4d4d4c;--src-line-numbers-span-color:#c67e2d;--src-line-number-highlighted-background-color:#fdffd3;--test-arrow-color:#f5f5f5;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#f5f5f5;--test-arrow-hover-background-color:rgb(78,139,202);--target-background-color:#fdffd3;--target-border-color:#ad7c37;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:initial;--crate-search-div-filter:invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg) brightness(114%) contrast(76%);--crate-search-div-hover-filter:invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg) brightness(96%) contrast(93%);--crate-search-hover-border:#717171;--src-sidebar-background-selected:#fff;--src-sidebar-background-hover:#e0e0e0;--table-alt-row-background-color:#f5f5f5;--codeblock-link-background:#eee;--scrape-example-toggle-line-background:#ccc;--scrape-example-toggle-line-hover-background:#999;--scrape-example-code-line-highlight:#fcffd6;--scrape-example-code-line-highlight-focus:#f6fdb0;--scrape-example-help-border-color:#555;--scrape-example-help-color:#333;--scrape-example-help-hover-border-color:#000;--scrape-example-help-hover-color:#000;--scrape-example-code-wrapper-background-start:rgba(255,255,255,1);--scrape-example-code-wrapper-background-end:rgba(255,255,255,0);--sidebar-resizer-hover:hsl(207,90%,66%);--sidebar-resizer-active:hsl(207,90%,54%);}:root[data-theme="dark"]{--main-background-color:#353535;--main-color:#ddd;--settings-input-color:#2196f3;--settings-input-border-color:#999;--settings-button-color:#000;--settings-button-border-focus:#ffb900;--sidebar-background-color:#505050;--sidebar-background-color-hover:#676767;--code-block-background-color:#2A2A2A;--scrollbar-track-background-color:#717171;--scrollbar-thumb-background-color:rgba(32,34,37,.6);--scrollbar-color:rgba(32,34,37,.6) #5a5a5a;--headings-border-bottom-color:#d2d2d2;--border-color:#e0e0e0;--button-background-color:#f0f0f0;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--mobile-sidebar-menu-filter:invert(100%);--search-input-focused-border-color:#008dfd;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(65%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#2dbfb8;--trait-link-color:#b78cf2;--assoc-item-link-color:#d2991d;--function-link-color:#2bab63;--macro-link-color:#09bd00;--keyword-link-color:#d2991d;--mod-link-color:#d2991d;--link-color:#d2991d;--sidebar-link-color:#fdbf35;--sidebar-current-link-background-color:#444;--search-result-link-focus-background-color:#616161;--search-result-border-color:#aaa3;--search-color:#111;--search-error-code-background-color:#484848;--search-results-alias-color:#fff;--search-results-grey-color:#ccc;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#252525;--search-tab-button-not-selected-background:#252525;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#353535;--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ab8ac1;--code-highlight-kw-2-color:#769acb;--code-highlight-lifetime-color:#d97f26;--code-highlight-prelude-color:#769acb;--code-highlight-prelude-val-color:#ee6868;--code-highlight-number-color:#83a300;--code-highlight-string-color:#83a300;--code-highlight-literal-color:#ee6868;--code-highlight-attribute-color:#ee6868;--code-highlight-self-color:#ee6868;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8d8d8b;--code-highlight-doc-comment-color:#8ca375;--src-line-numbers-span-color:#3b91e2;--src-line-number-highlighted-background-color:#0a042f;--test-arrow-color:#dedede;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#dedede;--test-arrow-hover-background-color:#4e8bca;--target-background-color:#494a3d;--target-border-color:#bb7410;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(94%) sepia(0%) saturate(721%) hue-rotate(255deg) brightness(90%) contrast(90%);--crate-search-div-hover-filter:invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%);--crate-search-hover-border:#2196f3;--src-sidebar-background-selected:#333;--src-sidebar-background-hover:#444;--table-alt-row-background-color:#2a2a2a;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(53,53,53,1);--scrape-example-code-wrapper-background-end:rgba(53,53,53,0);--sidebar-resizer-hover:hsl(207,30%,54%);--sidebar-resizer-active:hsl(207,90%,54%);}:root[data-theme="ayu"]{--main-background-color:#0f1419;--main-color:#c5c5c5;--settings-input-color:#ffb454;--settings-input-border-color:#999;--settings-button-color:#fff;--settings-button-border-focus:#e0e0e0;--sidebar-background-color:#14191f;--sidebar-background-color-hover:rgba(70,70,70,0.33);--code-block-background-color:#191f26;--scrollbar-track-background-color:transparent;--scrollbar-thumb-background-color:#5c6773;--scrollbar-color:#5c6773 #24292f;--headings-border-bottom-color:#5c6773;--border-color:#5c6773;--button-background-color:#141920;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--mobile-sidebar-menu-filter:invert(100%);--search-input-focused-border-color:#5c6773;--copy-path-button-color:#fff;--copy-path-img-filter:invert(70%);--copy-path-img-hover-filter:invert(100%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ffa0a5;--trait-link-color:#39afd7;--assoc-item-link-color:#39afd7;--function-link-color:#fdd687;--macro-link-color:#a37acc;--keyword-link-color:#39afd7;--mod-link-color:#39afd7;--link-color:#39afd7;--sidebar-link-color:#53b1db;--sidebar-current-link-background-color:transparent;--search-result-link-focus-background-color:#3c3c3c;--search-result-border-color:#aaa3;--search-color:#fff;--search-error-code-background-color:#4f4c4c;--search-results-alias-color:#c5c5c5;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:none;--search-tab-button-not-selected-background:transparent !important;--search-tab-button-selected-border-top-color:none;--search-tab-button-selected-background:#141920 !important;--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ff7733;--code-highlight-kw-2-color:#ff7733;--code-highlight-lifetime-color:#ff7733;--code-highlight-prelude-color:#69f2df;--code-highlight-prelude-val-color:#ff7733;--code-highlight-number-color:#b8cc52;--code-highlight-string-color:#b8cc52;--code-highlight-literal-color:#ff7733;--code-highlight-attribute-color:#e6e1cf;--code-highlight-self-color:#36a3d9;--code-highlight-macro-color:#a37acc;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#788797;--code-highlight-doc-comment-color:#a1ac88;--src-line-numbers-span-color:#5c6773;--src-line-number-highlighted-background-color:rgba(255,236,164,0.06);--test-arrow-color:#788797;--test-arrow-background-color:rgba(57,175,215,0.09);--test-arrow-hover-color:#c5c5c5;--test-arrow-hover-background-color:rgba(57,175,215,0.368);--target-background-color:rgba(255,236,164,0.06);--target-border-color:rgba(255,180,76,0.85);--kbd-color:#c5c5c5;--kbd-background:#314559;--kbd-box-shadow-color:#5c6773;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(41%) sepia(12%) saturate(487%) hue-rotate(171deg) brightness(94%) contrast(94%);--crate-search-div-hover-filter:invert(98%) sepia(12%) saturate(81%) hue-rotate(343deg) brightness(113%) contrast(76%);--crate-search-hover-border:#e0e0e0;--src-sidebar-background-selected:#14191f;--src-sidebar-background-hover:#14191f;--table-alt-row-background-color:#191f26;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(15,20,25,1);--scrape-example-code-wrapper-background-end:rgba(15,20,25,0);--sidebar-resizer-hover:hsl(34,50%,33%);--sidebar-resizer-active:hsl(34,100%,66%);}:root[data-theme="ayu"] h1,:root[data-theme="ayu"] h2,:root[data-theme="ayu"] h3,:root[data-theme="ayu"] h4,:where(:root[data-theme="ayu"]) h1 a,:root[data-theme="ayu"] .sidebar h2 a,:root[data-theme="ayu"] .sidebar h3 a{color:#fff;}:root[data-theme="ayu"] .docblock code{color:#ffb454;}:root[data-theme="ayu"] .docblock a>code{color:#39AFD7 !important;}:root[data-theme="ayu"] .code-header,:root[data-theme="ayu"] .docblock pre>code,:root[data-theme="ayu"] pre,:root[data-theme="ayu"] pre>code,:root[data-theme="ayu"] .item-info code,:root[data-theme="ayu"] .rustdoc.source .example-wrap{color:#e6e1cf;}:root[data-theme="ayu"] .sidebar .current,:root[data-theme="ayu"] .sidebar .current a,:root[data-theme="ayu"] .sidebar a:hover,:root[data-theme="ayu"] #src-sidebar div.files>a:hover,:root[data-theme="ayu"] details.dir-entry summary:hover,:root[data-theme="ayu"] #src-sidebar div.files>a:focus,:root[data-theme="ayu"] details.dir-entry summary:focus,:root[data-theme="ayu"] #src-sidebar div.files>a.selected{color:#ffb44c;}:root[data-theme="ayu"] .sidebar-elems .location{color:#ff7733;}:root[data-theme="ayu"] .src-line-numbers .line-highlighted{color:#708090;padding-right:7px;border-right:1px solid #ffb44c;}:root[data-theme="ayu"] .search-results a:hover,:root[data-theme="ayu"] .search-results a:focus{color:#fff !important;background-color:#3c3c3c;}:root[data-theme="ayu"] .search-results a{color:#0096cf;}:root[data-theme="ayu"] .search-results a div.desc{color:#c5c5c5;}:root[data-theme="ayu"] .result-name .primitive>i,:root[data-theme="ayu"] .result-name .keyword>i{color:#788797;}:root[data-theme="ayu"] #search-tabs>button.selected{border-bottom:1px solid #ffb44c !important;border-top:none;}:root[data-theme="ayu"] #search-tabs>button:not(.selected){border:none;background-color:transparent !important;}:root[data-theme="ayu"] #search-tabs>button:hover{border-bottom:1px solid rgba(242,151,24,0.3);}:root[data-theme="ayu"] #settings-menu>a img,:root[data-theme="ayu"] #sidebar-button>a:before{filter:invert(100);} \ No newline at end of file diff --git a/docs/static.files/scrape-examples-ef1e698c1d417c0c.js b/docs/static.files/scrape-examples-ef1e698c1d417c0c.js new file mode 100644 index 00000000..ba830e37 --- /dev/null +++ b/docs/static.files/scrape-examples-ef1e698c1d417c0c.js @@ -0,0 +1 @@ +"use strict";(function(){const DEFAULT_MAX_LINES=5;const HIDDEN_MAX_LINES=10;function scrollToLoc(elt,loc,isHidden){const lines=elt.querySelector(".src-line-numbers");let scrollOffset;const maxLines=isHidden?HIDDEN_MAX_LINES:DEFAULT_MAX_LINES;if(loc[1]-loc[0]>maxLines){const line=Math.max(0,loc[0]-1);scrollOffset=lines.children[line].offsetTop}else{const wrapper=elt.querySelector(".code-wrapper");const halfHeight=wrapper.offsetHeight/2;const offsetTop=lines.children[loc[0]].offsetTop;const lastLine=lines.children[loc[1]];const offsetBot=lastLine.offsetTop+lastLine.offsetHeight;const offsetMid=(offsetTop+offsetBot)/2;scrollOffset=offsetMid-halfHeight}lines.scrollTo(0,scrollOffset);elt.querySelector(".rust").scrollTo(0,scrollOffset)}function updateScrapedExample(example,isHidden){const locs=JSON.parse(example.attributes.getNamedItem("data-locs").textContent);let locIndex=0;const highlights=Array.prototype.slice.call(example.querySelectorAll(".highlight"));const link=example.querySelector(".scraped-example-title a");if(locs.length>1){const onChangeLoc=changeIndex=>{removeClass(highlights[locIndex],"focus");changeIndex();scrollToLoc(example,locs[locIndex][0],isHidden);addClass(highlights[locIndex],"focus");const url=locs[locIndex][1];const title=locs[locIndex][2];link.href=url;link.innerHTML=title};example.querySelector(".prev").addEventListener("click",()=>{onChangeLoc(()=>{locIndex=(locIndex-1+locs.length)%locs.length})});example.querySelector(".next").addEventListener("click",()=>{onChangeLoc(()=>{locIndex=(locIndex+1)%locs.length})})}const expandButton=example.querySelector(".expand");if(expandButton){expandButton.addEventListener("click",()=>{if(hasClass(example,"expanded")){removeClass(example,"expanded");scrollToLoc(example,locs[0][0],isHidden)}else{addClass(example,"expanded")}})}scrollToLoc(example,locs[0][0],isHidden)}const firstExamples=document.querySelectorAll(".scraped-example-list > .scraped-example");onEachLazy(firstExamples,el=>updateScrapedExample(el,false));onEachLazy(document.querySelectorAll(".more-examples-toggle"),toggle=>{onEachLazy(toggle.querySelectorAll(".toggle-line, .hide-more"),button=>{button.addEventListener("click",()=>{toggle.open=false})});const moreExamples=toggle.querySelectorAll(".scraped-example");toggle.querySelector("summary").addEventListener("click",()=>{setTimeout(()=>{onEachLazy(moreExamples,el=>updateScrapedExample(el,true))})},{once:true})})})() \ No newline at end of file diff --git a/docs/static.files/search-42d8da7a6b9792c2.js b/docs/static.files/search-42d8da7a6b9792c2.js new file mode 100644 index 00000000..1d178d53 --- /dev/null +++ b/docs/static.files/search-42d8da7a6b9792c2.js @@ -0,0 +1,5 @@ +"use strict";if(!Array.prototype.toSpliced){Array.prototype.toSpliced=function(){const me=this.slice();Array.prototype.splice.apply(me,arguments);return me}}(function(){const itemTypes=["keyword","primitive","mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","associatedtype","constant","associatedconstant","union","foreigntype","existential","attr","derive","traitalias","generic",];const longItemTypes=["keyword","primitive type","module","extern crate","re-export","struct","enum","function","type alias","static","trait","","trait method","method","struct field","enum variant","macro","assoc type","constant","assoc const","union","foreign type","existential type","attribute macro","derive macro","trait alias",];const TY_GENERIC=itemTypes.indexOf("generic");const ROOT_PATH=typeof window!=="undefined"?window.rootPath:"../";const UNBOXING_LIMIT=5;function printTab(nb){let iter=0;let foundCurrentTab=false;let foundCurrentResultSet=false;onEachLazy(document.getElementById("search-tabs").childNodes,elem=>{if(nb===iter){addClass(elem,"selected");foundCurrentTab=true}else{removeClass(elem,"selected")}iter+=1});const isTypeSearch=(nb>0||iter===1);iter=0;onEachLazy(document.getElementById("results").childNodes,elem=>{if(nb===iter){addClass(elem,"active");foundCurrentResultSet=true}else{removeClass(elem,"active")}iter+=1});if(foundCurrentTab&&foundCurrentResultSet){searchState.currentTab=nb;const correctionsElem=document.getElementsByClassName("search-corrections");if(isTypeSearch){removeClass(correctionsElem[0],"hidden")}else{addClass(correctionsElem[0],"hidden")}}else if(nb!==0){printTab(0)}}const editDistanceState={current:[],prev:[],prevPrev:[],calculate:function calculate(a,b,limit){if(a.lengthlimit){return limit+1}while(b.length>0&&b[0]===a[0]){a=a.substring(1);b=b.substring(1)}while(b.length>0&&b[b.length-1]===a[a.length-1]){a=a.substring(0,a.length-1);b=b.substring(0,b.length-1)}if(b.length===0){return minDist}const aLength=a.length;const bLength=b.length;for(let i=0;i<=bLength;++i){this.current[i]=0;this.prev[i]=i;this.prevPrev[i]=Number.MAX_VALUE}for(let i=1;i<=aLength;++i){this.current[0]=i;const aIdx=i-1;for(let j=1;j<=bLength;++j){const bIdx=j-1;const substitutionCost=a[aIdx]===b[bIdx]?0:1;this.current[j]=Math.min(this.prev[j]+1,this.current[j-1]+1,this.prev[j-1]+substitutionCost);if((i>1)&&(j>1)&&(a[aIdx]===b[bIdx-1])&&(a[aIdx-1]===b[bIdx])){this.current[j]=Math.min(this.current[j],this.prevPrev[j-2]+1)}}const prevPrevTmp=this.prevPrev;this.prevPrev=this.prev;this.prev=this.current;this.current=prevPrevTmp}const distance=this.prev[bLength];return distance<=limit?distance:(limit+1)},};function editDistance(a,b,limit){return editDistanceState.calculate(a,b,limit)}function initSearch(rawSearchIndex){const MAX_RESULTS=200;const NO_TYPE_FILTER=-1;let searchIndex;let functionTypeFingerprint;let currentResults;const typeNameIdMap=new Map();const ALIASES=new Map();const typeNameIdOfArray=buildTypeMapIndex("array");const typeNameIdOfSlice=buildTypeMapIndex("slice");const typeNameIdOfArrayOrSlice=buildTypeMapIndex("[]");const typeNameIdOfTuple=buildTypeMapIndex("tuple");const typeNameIdOfUnit=buildTypeMapIndex("unit");const typeNameIdOfTupleOrUnit=buildTypeMapIndex("()");const typeNameIdOfFn=buildTypeMapIndex("fn");const typeNameIdOfFnMut=buildTypeMapIndex("fnmut");const typeNameIdOfFnOnce=buildTypeMapIndex("fnonce");const typeNameIdOfHof=buildTypeMapIndex("->");function buildTypeMapIndex(name,isAssocType){if(name===""||name===null){return null}if(typeNameIdMap.has(name)){const obj=typeNameIdMap.get(name);obj.assocOnly=isAssocType&&obj.assocOnly;return obj.id}else{const id=typeNameIdMap.size;typeNameIdMap.set(name,{id,assocOnly:isAssocType});return id}}function isSpecialStartCharacter(c){return"<\"".indexOf(c)!==-1}function isEndCharacter(c){return"=,>-])".indexOf(c)!==-1}function itemTypeFromName(typename){const index=itemTypes.findIndex(i=>i===typename);if(index<0){throw["Unknown type filter ",typename]}return index}function getStringElem(query,parserState,isInGenerics){if(isInGenerics){throw["Unexpected ","\""," in generics"]}else if(query.literalSearch){throw["Cannot have more than one literal search element"]}else if(parserState.totalElems-parserState.genericsElems>0){throw["Cannot use literal search when there is more than one element"]}parserState.pos+=1;const start=parserState.pos;const end=getIdentEndPosition(parserState);if(parserState.pos>=parserState.length){throw["Unclosed ","\""]}else if(parserState.userQuery[end]!=="\""){throw["Unexpected ",parserState.userQuery[end]," in a string element"]}else if(start===end){throw["Cannot have empty string element"]}parserState.pos+=1;query.literalSearch=true}function isPathStart(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="::"}function isReturnArrow(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="->"}function isIdentCharacter(c){return(c==="_"||(c>="0"&&c<="9")||(c>="a"&&c<="z")||(c>="A"&&c<="Z"))}function isSeparatorCharacter(c){return c===","||c==="="}function isPathSeparator(c){return c===":"||c===" "}function prevIs(parserState,lookingFor){let pos=parserState.pos;while(pos>0){const c=parserState.userQuery[pos-1];if(c===lookingFor){return true}else if(c!==" "){break}pos-=1}return false}function isLastElemGeneric(elems,parserState){return(elems.length>0&&elems[elems.length-1].generics.length>0)||prevIs(parserState,">")}function skipWhitespace(parserState){while(parserState.pos0){throw["Cannot have more than one element if you use quotes"]}const typeFilter=parserState.typeFilter;parserState.typeFilter=null;if(name==="!"){if(typeFilter!==null&&typeFilter!=="primitive"){throw["Invalid search type: primitive never type ","!"," and ",typeFilter," both specified",]}if(generics.length!==0){throw["Never type ","!"," does not accept generic parameters",]}const bindingName=parserState.isInBinding;parserState.isInBinding=null;return makePrimitiveElement("never",{bindingName})}const quadcolon=/::\s*::/.exec(path);if(path.startsWith("::")){throw["Paths cannot start with ","::"]}else if(path.endsWith("::")){throw["Paths cannot end with ","::"]}else if(quadcolon!==null){throw["Unexpected ",quadcolon[0]]}const pathSegments=path.split(/(?:::\s*)|(?:\s+(?:::\s*)?)/);if(pathSegments.length===0||(pathSegments.length===1&&pathSegments[0]==="")){if(generics.length>0||prevIs(parserState,">")){throw["Found generics without a path"]}else{throw["Unexpected ",parserState.userQuery[parserState.pos]]}}for(const[i,pathSegment]of pathSegments.entries()){if(pathSegment==="!"){if(i!==0){throw["Never type ","!"," is not associated item"]}pathSegments[i]="never"}}parserState.totalElems+=1;if(isInGenerics){parserState.genericsElems+=1}const bindingName=parserState.isInBinding;parserState.isInBinding=null;const bindings=new Map();const pathLast=pathSegments[pathSegments.length-1];return{name:name.trim(),id:null,fullPath:pathSegments,pathWithoutLast:pathSegments.slice(0,pathSegments.length-1),pathLast,normalizedPathLast:pathLast.replace(/_/g,""),generics:generics.filter(gen=>{if(gen.bindingName!==null){if(gen.name!==null){gen.bindingName.generics.unshift(gen)}bindings.set(gen.bindingName.name,gen.bindingName.generics);return false}return true}),bindings,typeFilter,bindingName,}}function getIdentEndPosition(parserState){const start=parserState.pos;let end=parserState.pos;let foundExclamation=-1;while(parserState.pos0){throw["Unexpected ",c," after ",parserState.userQuery[parserState.pos-1]]}else{throw["Unexpected ",c]}}parserState.pos+=1;end=parserState.pos}if(foundExclamation!==-1&&foundExclamation!==start&&isIdentCharacter(parserState.userQuery[foundExclamation-1])){if(parserState.typeFilter===null){parserState.typeFilter="macro"}else if(parserState.typeFilter!=="macro"){throw["Invalid search type: macro ","!"," and ",parserState.typeFilter," both specified",]}end=foundExclamation}return end}function getFilteredNextElem(query,parserState,elems,isInGenerics){const start=parserState.pos;if(parserState.userQuery[parserState.pos]===":"&&!isPathStart(parserState)){throw["Expected type filter before ",":"]}getNextElem(query,parserState,elems,isInGenerics);if(parserState.userQuery[parserState.pos]===":"&&!isPathStart(parserState)){if(parserState.typeFilter!==null){throw["Unexpected ",":"," (expected path after type filter ",parserState.typeFilter+":",")",]}if(elems.length===0){throw["Expected type filter before ",":"]}else if(query.literalSearch){throw["Cannot use quotes on type filter"]}const typeFilterElem=elems.pop();checkExtraTypeFilterCharacters(start,parserState);parserState.typeFilter=typeFilterElem.name;parserState.pos+=1;parserState.totalElems-=1;query.literalSearch=false;getNextElem(query,parserState,elems,isInGenerics)}}function getNextElem(query,parserState,elems,isInGenerics){const generics=[];skipWhitespace(parserState);let start=parserState.pos;let end;if("[(".indexOf(parserState.userQuery[parserState.pos])!==-1){let endChar=")";let name="()";let friendlyName="tuple";if(parserState.userQuery[parserState.pos]==="["){endChar="]";name="[]";friendlyName="slice"}parserState.pos+=1;const{foundSeparator}=getItemsBefore(query,parserState,generics,endChar);const typeFilter=parserState.typeFilter;const bindingName=parserState.isInBinding;parserState.typeFilter=null;parserState.isInBinding=null;for(const gen of generics){if(gen.bindingName!==null){throw["Type parameter ","=",` cannot be within ${friendlyName} `,name]}}if(name==="()"&&!foundSeparator&&generics.length===1&&typeFilter===null){elems.push(generics[0])}else if(name==="()"&&generics.length===1&&generics[0].name==="->"){generics[0].typeFilter=typeFilter;elems.push(generics[0])}else{if(typeFilter!==null&&typeFilter!=="primitive"){throw["Invalid search type: primitive ",name," and ",typeFilter," both specified",]}parserState.totalElems+=1;if(isInGenerics){parserState.genericsElems+=1}elems.push(makePrimitiveElement(name,{bindingName,generics}))}}else{const isStringElem=parserState.userQuery[start]==="\"";if(isStringElem){start+=1;getStringElem(query,parserState,isInGenerics);end=parserState.pos-1}else{end=getIdentEndPosition(parserState)}if(parserState.pos=end){throw["Found generics without a path"]}parserState.pos+=1;getItemsBefore(query,parserState,generics,">")}else if(parserState.pos=end){throw["Found generics without a path"]}if(parserState.isInBinding){throw["Unexpected ","("," after ","="]}parserState.pos+=1;const typeFilter=parserState.typeFilter;parserState.typeFilter=null;getItemsBefore(query,parserState,generics,")");skipWhitespace(parserState);if(isReturnArrow(parserState)){parserState.pos+=2;skipWhitespace(parserState);getFilteredNextElem(query,parserState,generics,isInGenerics);generics[generics.length-1].bindingName=makePrimitiveElement("output")}else{generics.push(makePrimitiveElement(null,{bindingName:makePrimitiveElement("output"),typeFilter:null,}))}parserState.typeFilter=typeFilter}if(isStringElem){skipWhitespace(parserState)}if(start>=end&&generics.length===0){return}if(parserState.userQuery[parserState.pos]==="="){if(parserState.isInBinding){throw["Cannot write ","="," twice in a binding"]}if(!isInGenerics){throw["Type parameter ","="," must be within generics list"]}const name=parserState.userQuery.slice(start,end).trim();if(name==="!"){throw["Type parameter ","="," key cannot be ","!"," never type"]}if(name.includes("!")){throw["Type parameter ","="," key cannot be ","!"," macro"]}if(name.includes("::")){throw["Type parameter ","="," key cannot contain ","::"," path"]}if(name.includes(":")){throw["Type parameter ","="," key cannot contain ",":"," type"]}parserState.isInBinding={name,generics}}else{elems.push(createQueryElement(query,parserState,parserState.userQuery.slice(start,end),generics,isInGenerics))}}}function getItemsBefore(query,parserState,elems,endChar){let foundStopChar=true;let foundSeparator=false;const oldTypeFilter=parserState.typeFilter;parserState.typeFilter=null;const oldIsInBinding=parserState.isInBinding;parserState.isInBinding=null;let hofParameters=null;let extra="";if(endChar===">"){extra="<"}else if(endChar==="]"){extra="["}else if(endChar===")"){extra="("}else if(endChar===""){extra="->"}else{extra=endChar}while(parserState.pos"," after ","="]}hofParameters=[...elems];elems.length=0;parserState.pos+=2;foundStopChar=true;foundSeparator=false;continue}else if(c===" "){parserState.pos+=1;continue}else if(isSeparatorCharacter(c)){parserState.pos+=1;foundStopChar=true;foundSeparator=true;continue}else if(c===":"&&isPathStart(parserState)){throw["Unexpected ","::",": paths cannot start with ","::"]}else if(isEndCharacter(c)){throw["Unexpected ",c," after ",extra]}if(!foundStopChar){let extra=[];if(isLastElemGeneric(query.elems,parserState)){extra=[" after ",">"]}else if(prevIs(parserState,"\"")){throw["Cannot have more than one element if you use quotes"]}if(endChar!==""){throw["Expected ",",",", ","=",", or ",endChar,...extra,", found ",c,]}throw["Expected ",","," or ","=",...extra,", found ",c,]}const posBefore=parserState.pos;getFilteredNextElem(query,parserState,elems,endChar!=="");if(endChar!==""&&parserState.pos>=parserState.length){throw["Unclosed ",extra]}if(posBefore===parserState.pos){parserState.pos+=1}foundStopChar=false}if(parserState.pos>=parserState.length&&endChar!==""){throw["Unclosed ",extra]}parserState.pos+=1;if(hofParameters){foundSeparator=false;if([...elems,...hofParameters].some(x=>x.bindingName)||parserState.isInBinding){throw["Unexpected ","="," within ","->"]}const hofElem=makePrimitiveElement("->",{generics:hofParameters,bindings:new Map([["output",[...elems]]]),typeFilter:null,});elems.length=0;elems[0]=hofElem}parserState.typeFilter=oldTypeFilter;parserState.isInBinding=oldIsInBinding;return{foundSeparator}}function checkExtraTypeFilterCharacters(start,parserState){const query=parserState.userQuery.slice(start,parserState.pos).trim();for(const c in query){if(!isIdentCharacter(query[c])){throw["Unexpected ",query[c]," in type filter (before ",":",")",]}}}function parseInput(query,parserState){let foundStopChar=true;while(parserState.pos"){if(isReturnArrow(parserState)){break}throw["Unexpected ",c," (did you mean ","->","?)"]}else if(parserState.pos>0){throw["Unexpected ",c," after ",parserState.userQuery[parserState.pos-1]]}throw["Unexpected ",c]}else if(c===" "){skipWhitespace(parserState);continue}if(!foundStopChar){let extra="";if(isLastElemGeneric(query.elems,parserState)){extra=[" after ",">"]}else if(prevIs(parserState,"\"")){throw["Cannot have more than one element if you use quotes"]}if(parserState.typeFilter!==null){throw["Expected ",","," or ","->",...extra,", found ",c,]}throw["Expected ",",",", ",":"," or ","->",...extra,", found ",c,]}const before=query.elems.length;getFilteredNextElem(query,parserState,query.elems,false);if(query.elems.length===before){parserState.pos+=1}foundStopChar=false}if(parserState.typeFilter!==null){throw["Unexpected ",":"," (expected path after type filter ",parserState.typeFilter+":",")",]}while(parserState.pos"]}break}else{parserState.pos+=1}}}function newParsedQuery(userQuery){return{original:userQuery,userQuery:userQuery.toLowerCase(),elems:[],returned:[],foundElems:0,totalElems:0,literalSearch:false,error:null,correction:null,proposeCorrectionFrom:null,proposeCorrectionTo:null,typeFingerprint:new Uint32Array(4),}}function buildUrl(search,filterCrates){let extra="?search="+encodeURIComponent(search);if(filterCrates!==null){extra+="&filter-crate="+encodeURIComponent(filterCrates)}return getNakedUrl()+extra+window.location.hash}function getFilterCrates(){const elem=document.getElementById("crate-search");if(elem&&elem.value!=="all crates"&&rawSearchIndex.has(elem.value)){return elem.value}return null}function parseQuery(userQuery){function convertTypeFilterOnElem(elem){if(elem.typeFilter!==null){let typeFilter=elem.typeFilter;if(typeFilter==="const"){typeFilter="constant"}elem.typeFilter=itemTypeFromName(typeFilter)}else{elem.typeFilter=NO_TYPE_FILTER}for(const elem2 of elem.generics){convertTypeFilterOnElem(elem2)}for(const constraints of elem.bindings.values()){for(const constraint of constraints){convertTypeFilterOnElem(constraint)}}}userQuery=userQuery.trim().replace(/\r|\n|\t/g," ");const parserState={length:userQuery.length,pos:0,totalElems:0,genericsElems:0,typeFilter:null,isInBinding:null,userQuery:userQuery.toLowerCase(),};let query=newParsedQuery(userQuery);try{parseInput(query,parserState);for(const elem of query.elems){convertTypeFilterOnElem(elem)}for(const elem of query.returned){convertTypeFilterOnElem(elem)}}catch(err){query=newParsedQuery(userQuery);query.error=err;return query}if(!query.literalSearch){query.literalSearch=parserState.totalElems>1}query.foundElems=query.elems.length+query.returned.length;query.totalElems=parserState.totalElems;return query}function createQueryResults(results_in_args,results_returned,results_others,parsedQuery){return{"in_args":results_in_args,"returned":results_returned,"others":results_others,"query":parsedQuery,}}function execQuery(parsedQuery,filterCrates,currentCrate){const results_others=new Map(),results_in_args=new Map(),results_returned=new Map();function transformResults(results){const duplicates=new Set();const out=[];for(const result of results){if(result.id!==-1){const obj=searchIndex[result.id];obj.dist=result.dist;const res=buildHrefAndPath(obj);obj.displayPath=pathSplitter(res[0]);obj.fullPath=obj.displayPath+obj.name;obj.fullPath+="|"+obj.ty;if(duplicates.has(obj.fullPath)){continue}duplicates.add(obj.fullPath);obj.href=res[1];out.push(obj);if(out.length>=MAX_RESULTS){break}}}return out}function sortResults(results,isType,preferredCrate){const userQuery=parsedQuery.userQuery;const result_list=[];for(const result of results.values()){result.item=searchIndex[result.id];result.word=searchIndex[result.id].word;result_list.push(result)}result_list.sort((aaa,bbb)=>{let a,b;a=(aaa.word!==userQuery);b=(bbb.word!==userQuery);if(a!==b){return a-b}a=(aaa.index<0);b=(bbb.index<0);if(a!==b){return a-b}a=aaa.path_dist;b=bbb.path_dist;if(a!==b){return a-b}a=aaa.index;b=bbb.index;if(a!==b){return a-b}a=(aaa.dist);b=(bbb.dist);if(a!==b){return a-b}a=aaa.item.deprecated;b=bbb.item.deprecated;if(a!==b){return a-b}a=(aaa.item.crate!==preferredCrate);b=(bbb.item.crate!==preferredCrate);if(a!==b){return a-b}a=aaa.word.length;b=bbb.word.length;if(a!==b){return a-b}a=aaa.word;b=bbb.word;if(a!==b){return(a>b?+1:-1)}a=(aaa.item.desc==="");b=(bbb.item.desc==="");if(a!==b){return a-b}a=aaa.item.ty;b=bbb.item.ty;if(a!==b){return a-b}a=aaa.item.path;b=bbb.item.path;if(a!==b){return(a>b?+1:-1)}return 0});return transformResults(result_list)}function unifyFunctionTypes(fnTypesIn,queryElems,whereClause,mgensIn,solutionCb,unboxingDepth){if(unboxingDepth>=UNBOXING_LIMIT){return false}const mgens=mgensIn===null?null:new Map(mgensIn);if(queryElems.length===0){return!solutionCb||solutionCb(mgens)}if(!fnTypesIn||fnTypesIn.length===0){return false}const ql=queryElems.length;const fl=fnTypesIn.length;if(ql===1&&queryElems[0].generics.length===0&&queryElems[0].bindings.size===0){const queryElem=queryElems[0];for(const fnType of fnTypesIn){if(!unifyFunctionTypeIsMatchCandidate(fnType,queryElem,mgens)){continue}if(fnType.id<0&&queryElem.id<0){if(mgens&&mgens.has(fnType.id)&&mgens.get(fnType.id)!==queryElem.id){continue}const mgensScratch=new Map(mgens);mgensScratch.set(fnType.id,queryElem.id);if(!solutionCb||solutionCb(mgensScratch)){return true}}else if(!solutionCb||solutionCb(mgens?new Map(mgens):null)){return true}}for(const fnType of fnTypesIn){if(!unifyFunctionTypeIsUnboxCandidate(fnType,queryElem,whereClause,mgens,unboxingDepth+1)){continue}if(fnType.id<0){if(mgens&&mgens.has(fnType.id)&&mgens.get(fnType.id)!==0){continue}const mgensScratch=new Map(mgens);mgensScratch.set(fnType.id,0);if(unifyFunctionTypes(whereClause[(-fnType.id)-1],queryElems,whereClause,mgensScratch,solutionCb,unboxingDepth+1)){return true}}else if(unifyFunctionTypes([...fnType.generics,...Array.from(fnType.bindings.values()).flat()],queryElems,whereClause,mgens?new Map(mgens):null,solutionCb,unboxingDepth+1)){return true}}return false}const fnTypes=fnTypesIn.slice();const flast=fl-1;const qlast=ql-1;const queryElem=queryElems[qlast];let queryElemsTmp=null;for(let i=flast;i>=0;i-=1){const fnType=fnTypes[i];if(!unifyFunctionTypeIsMatchCandidate(fnType,queryElem,mgens)){continue}let mgensScratch;if(fnType.id<0){mgensScratch=new Map(mgens);if(mgensScratch.has(fnType.id)&&mgensScratch.get(fnType.id)!==queryElem.id){continue}mgensScratch.set(fnType.id,queryElem.id)}else{mgensScratch=mgens}fnTypes[i]=fnTypes[flast];fnTypes.length=flast;if(!queryElemsTmp){queryElemsTmp=queryElems.slice(0,qlast)}const passesUnification=unifyFunctionTypes(fnTypes,queryElemsTmp,whereClause,mgensScratch,mgensScratch=>{if(fnType.generics.length===0&&queryElem.generics.length===0&&fnType.bindings.size===0&&queryElem.bindings.size===0){return!solutionCb||solutionCb(mgensScratch)}const solution=unifyFunctionTypeCheckBindings(fnType,queryElem,whereClause,mgensScratch,unboxingDepth);if(!solution){return false}const simplifiedGenerics=solution.simplifiedGenerics;for(const simplifiedMgens of solution.mgens){const passesUnification=unifyFunctionTypes(simplifiedGenerics,queryElem.generics,whereClause,simplifiedMgens,solutionCb,unboxingDepth);if(passesUnification){return true}}return false},unboxingDepth);if(passesUnification){return true}fnTypes[flast]=fnTypes[i];fnTypes[i]=fnType;fnTypes.length=fl}for(let i=flast;i>=0;i-=1){const fnType=fnTypes[i];if(!unifyFunctionTypeIsUnboxCandidate(fnType,queryElem,whereClause,mgens,unboxingDepth+1)){continue}let mgensScratch;if(fnType.id<0){mgensScratch=new Map(mgens);if(mgensScratch.has(fnType.id)&&mgensScratch.get(fnType.id)!==0){continue}mgensScratch.set(fnType.id,0)}else{mgensScratch=mgens}const generics=fnType.id<0?whereClause[(-fnType.id)-1]:fnType.generics;const bindings=fnType.bindings?Array.from(fnType.bindings.values()).flat():[];const passesUnification=unifyFunctionTypes(fnTypes.toSpliced(i,1,...generics,...bindings),queryElems,whereClause,mgensScratch,solutionCb,unboxingDepth+1);if(passesUnification){return true}}return false}function unifyFunctionTypeIsMatchCandidate(fnType,queryElem,mgensIn){if(!typePassesFilter(queryElem.typeFilter,fnType.ty)){return false}if(fnType.id<0&&queryElem.id<0){if(mgensIn){if(mgensIn.has(fnType.id)&&mgensIn.get(fnType.id)!==queryElem.id){return false}for(const[fid,qid]of mgensIn.entries()){if(fnType.id!==fid&&queryElem.id===qid){return false}if(fnType.id===fid&&queryElem.id!==qid){return false}}}return true}else{if(queryElem.id===typeNameIdOfArrayOrSlice&&(fnType.id===typeNameIdOfSlice||fnType.id===typeNameIdOfArray)){}else if(queryElem.id===typeNameIdOfTupleOrUnit&&(fnType.id===typeNameIdOfTuple||fnType.id===typeNameIdOfUnit)){}else if(queryElem.id===typeNameIdOfHof&&(fnType.id===typeNameIdOfFn||fnType.id===typeNameIdOfFnMut||fnType.id===typeNameIdOfFnOnce)){}else if(fnType.id!==queryElem.id||queryElem.id===null){return false}if((fnType.generics.length+fnType.bindings.size)===0&&queryElem.generics.length!==0){return false}if(fnType.bindings.size0){const fnTypePath=fnType.path!==undefined&&fnType.path!==null?fnType.path.split("::"):[];if(queryElemPathLength>fnTypePath.length){return false}let i=0;for(const path of fnTypePath){if(path===queryElem.pathWithoutLast[i]){i+=1;if(i>=queryElemPathLength){break}}}if(i0){let mgensSolutionSet=[mgensIn];for(const[name,constraints]of queryElem.bindings.entries()){if(mgensSolutionSet.length===0){return false}if(!fnType.bindings.has(name)){return false}const fnTypeBindings=fnType.bindings.get(name);mgensSolutionSet=mgensSolutionSet.flatMap(mgens=>{const newSolutions=[];unifyFunctionTypes(fnTypeBindings,constraints,whereClause,mgens,newMgens=>{newSolutions.push(newMgens);return false},unboxingDepth);return newSolutions})}if(mgensSolutionSet.length===0){return false}const binds=Array.from(fnType.bindings.entries()).flatMap(entry=>{const[name,constraints]=entry;if(queryElem.bindings.has(name)){return[]}else{return constraints}});if(simplifiedGenerics.length>0){simplifiedGenerics=[...simplifiedGenerics,...binds]}else{simplifiedGenerics=binds}return{simplifiedGenerics,mgens:mgensSolutionSet}}return{simplifiedGenerics,mgens:[mgensIn]}}function unifyFunctionTypeIsUnboxCandidate(fnType,queryElem,whereClause,mgens,unboxingDepth){if(unboxingDepth>=UNBOXING_LIMIT){return false}if(fnType.id<0&&queryElem.id>=0){if(!whereClause){return false}if(mgens&&mgens.has(fnType.id)&&mgens.get(fnType.id)!==0){return false}const mgensTmp=new Map(mgens);mgensTmp.set(fnType.id,null);return checkIfInList(whereClause[(-fnType.id)-1],queryElem,whereClause,mgensTmp,unboxingDepth)}else if(fnType.generics.length>0||fnType.bindings.size>0){const simplifiedGenerics=[...fnType.generics,...Array.from(fnType.bindings.values()).flat(),];return checkIfInList(simplifiedGenerics,queryElem,whereClause,mgens,unboxingDepth)}return false}function checkIfInList(list,elem,whereClause,mgens,unboxingDepth){for(const entry of list){if(checkType(entry,elem,whereClause,mgens,unboxingDepth)){return true}}return false}function checkType(row,elem,whereClause,mgens,unboxingDepth){if(unboxingDepth>=UNBOXING_LIMIT){return false}if(row.bindings.size===0&&elem.bindings.size===0){if(elem.id<0&&mgens===null){return row.id<0||checkIfInList(row.generics,elem,whereClause,mgens,unboxingDepth+1)}if(row.id>0&&elem.id>0&&elem.pathWithoutLast.length===0&&typePassesFilter(elem.typeFilter,row.ty)&&elem.generics.length===0&&elem.id!==typeNameIdOfArrayOrSlice&&elem.id!==typeNameIdOfTupleOrUnit&&elem.id!==typeNameIdOfHof){return row.id===elem.id||checkIfInList(row.generics,elem,whereClause,mgens,unboxingDepth)}}return unifyFunctionTypes([row],[elem],whereClause,mgens,null,unboxingDepth)}function checkPath(contains,ty){if(contains.length===0){return 0}const maxPathEditDistance=Math.floor(contains.reduce((acc,next)=>acc+next.length,0)/3);let ret_dist=maxPathEditDistance+1;const path=ty.path.split("::");if(ty.parent&&ty.parent.name){path.push(ty.parent.name.toLowerCase())}const length=path.length;const clength=contains.length;pathiter:for(let i=length-clength;i>=0;i-=1){let dist_total=0;for(let x=0;xmaxPathEditDistance){continue pathiter}dist_total+=dist}}ret_dist=Math.min(ret_dist,Math.round(dist_total/clength))}return ret_dist>maxPathEditDistance?null:ret_dist}function typePassesFilter(filter,type){if(filter<=NO_TYPE_FILTER||filter===type)return true;const name=itemTypes[type];switch(itemTypes[filter]){case"constant":return name==="associatedconstant";case"fn":return name==="method"||name==="tymethod";case"type":return name==="primitive"||name==="associatedtype";case"trait":return name==="traitalias"}return false}function createAliasFromItem(item){return{crate:item.crate,name:item.name,path:item.path,desc:item.desc,ty:item.ty,parent:item.parent,type:item.type,is_alias:true,deprecated:item.deprecated,implDisambiguator:item.implDisambiguator,}}function handleAliases(ret,query,filterCrates,currentCrate){const lowerQuery=query.toLowerCase();const aliases=[];const crateAliases=[];if(filterCrates!==null){if(ALIASES.has(filterCrates)&&ALIASES.get(filterCrates).has(lowerQuery)){const query_aliases=ALIASES.get(filterCrates).get(lowerQuery);for(const alias of query_aliases){aliases.push(createAliasFromItem(searchIndex[alias]))}}}else{for(const[crate,crateAliasesIndex]of ALIASES){if(crateAliasesIndex.has(lowerQuery)){const pushTo=crate===currentCrate?crateAliases:aliases;const query_aliases=crateAliasesIndex.get(lowerQuery);for(const alias of query_aliases){pushTo.push(createAliasFromItem(searchIndex[alias]))}}}}const sortFunc=(aaa,bbb)=>{if(aaa.path{alias.alias=query;const res=buildHrefAndPath(alias);alias.displayPath=pathSplitter(res[0]);alias.fullPath=alias.displayPath+alias.name;alias.href=res[1];ret.others.unshift(alias);if(ret.others.length>MAX_RESULTS){ret.others.pop()}};aliases.forEach(pushFunc);crateAliases.forEach(pushFunc)}function addIntoResults(results,fullId,id,index,dist,path_dist,maxEditDistance){if(dist<=maxEditDistance||index!==-1){if(results.has(fullId)){const result=results.get(fullId);if(result.dontValidate||result.dist<=dist){return}}results.set(fullId,{id:id,index:index,dontValidate:parsedQuery.literalSearch,dist:dist,path_dist:path_dist,})}}function handleSingleArg(row,pos,elem,results_others,results_in_args,results_returned,maxEditDistance){if(!row||(filterCrates!==null&&row.crate!==filterCrates)){return}let path_dist=0;const fullId=row.id;const tfpDist=compareTypeFingerprints(fullId,parsedQuery.typeFingerprint);if(tfpDist!==null){const in_args=row.type&&row.type.inputs&&checkIfInList(row.type.inputs,elem,row.type.where_clause,null,0);const returned=row.type&&row.type.output&&checkIfInList(row.type.output,elem,row.type.where_clause,null,0);if(in_args){results_in_args.max_dist=Math.max(results_in_args.max_dist||0,tfpDist);const maxDist=results_in_args.sizenormalizedIndex&&normalizedIndex!==-1)){index=normalizedIndex}if(elem.fullPath.length>1){path_dist=checkPath(elem.pathWithoutLast,row);if(path_dist===null){return}}if(parsedQuery.literalSearch){if(row.word===elem.pathLast){addIntoResults(results_others,fullId,pos,index,0,path_dist)}return}const dist=editDistance(row.normalizedName,elem.normalizedPathLast,maxEditDistance);if(index===-1&&dist>maxEditDistance){return}addIntoResults(results_others,fullId,pos,index,dist,path_dist,maxEditDistance)}function handleArgs(row,pos,results){if(!row||(filterCrates!==null&&row.crate!==filterCrates)||!row.type){return}const tfpDist=compareTypeFingerprints(row.id,parsedQuery.typeFingerprint);if(tfpDist===null){return}if(results.size>=MAX_RESULTS&&tfpDist>results.max_dist){return}if(!unifyFunctionTypes(row.type.inputs,parsedQuery.elems,row.type.where_clause,null,mgens=>{return unifyFunctionTypes(row.type.output,parsedQuery.returned,row.type.where_clause,mgens,null,0)},0)){return}results.max_dist=Math.max(results.max_dist||0,tfpDist);addIntoResults(results,row.id,pos,0,tfpDist,0,Number.MAX_VALUE)}function innerRunQuery(){const queryLen=parsedQuery.elems.reduce((acc,next)=>acc+next.pathLast.length,0)+parsedQuery.returned.reduce((acc,next)=>acc+next.pathLast.length,0);const maxEditDistance=Math.floor(queryLen/3);const genericSymbols=new Map();function convertNameToId(elem,isAssocType){if(typeNameIdMap.has(elem.normalizedPathLast)&&(isAssocType||!typeNameIdMap.get(elem.normalizedPathLast).assocOnly)){elem.id=typeNameIdMap.get(elem.normalizedPathLast).id}else if(!parsedQuery.literalSearch){let match=null;let matchDist=maxEditDistance+1;let matchName="";for(const[name,{id,assocOnly}]of typeNameIdMap){const dist=editDistance(name,elem.normalizedPathLast,maxEditDistance);if(dist<=matchDist&&dist<=maxEditDistance&&(isAssocType||!assocOnly)){if(dist===matchDist&&matchName>name){continue}match=id;matchDist=dist;matchName=name}}if(match!==null){parsedQuery.correction=matchName}elem.id=match}if((elem.id===null&&parsedQuery.totalElems>1&&elem.typeFilter===-1&&elem.generics.length===0&&elem.bindings.size===0)||elem.typeFilter===TY_GENERIC){if(genericSymbols.has(elem.name)){elem.id=genericSymbols.get(elem.name)}else{elem.id=-(genericSymbols.size+1);genericSymbols.set(elem.name,elem.id)}if(elem.typeFilter===-1&&elem.name.length>=3){const maxPartDistance=Math.floor(elem.name.length/3);let matchDist=maxPartDistance+1;let matchName="";for(const name of typeNameIdMap.keys()){const dist=editDistance(name,elem.name,maxPartDistance);if(dist<=matchDist&&dist<=maxPartDistance){if(dist===matchDist&&matchName>name){continue}matchDist=dist;matchName=name}}if(matchName!==""){parsedQuery.proposeCorrectionFrom=elem.name;parsedQuery.proposeCorrectionTo=matchName}}elem.typeFilter=TY_GENERIC}if(elem.generics.length>0&&elem.typeFilter===TY_GENERIC){parsedQuery.error=["Generic type parameter ",elem.name," does not accept generic parameters",]}for(const elem2 of elem.generics){convertNameToId(elem2)}elem.bindings=new Map(Array.from(elem.bindings.entries()).map(entry=>{const[name,constraints]=entry;if(!typeNameIdMap.has(name)){parsedQuery.error=["Type parameter ",name," does not exist",];return[null,[]]}for(const elem2 of constraints){convertNameToId(elem2)}return[typeNameIdMap.get(name).id,constraints]}))}const fps=new Set();for(const elem of parsedQuery.elems){convertNameToId(elem);buildFunctionTypeFingerprint(elem,parsedQuery.typeFingerprint,fps)}for(const elem of parsedQuery.returned){convertNameToId(elem);buildFunctionTypeFingerprint(elem,parsedQuery.typeFingerprint,fps)}if(parsedQuery.foundElems===1&&parsedQuery.returned.length===0){if(parsedQuery.elems.length===1){const elem=parsedQuery.elems[0];for(let i=0,nSearchIndex=searchIndex.length;i0){const sortQ=(a,b)=>{const ag=a.generics.length===0&&a.bindings.size===0;const bg=b.generics.length===0&&b.bindings.size===0;if(ag!==bg){return ag-bg}const ai=a.id>0;const bi=b.id>0;return ai-bi};parsedQuery.elems.sort(sortQ);parsedQuery.returned.sort(sortQ);for(let i=0,nSearchIndex=searchIndex.length;i");if(tmp.endsWith("")){return tmp.slice(0,tmp.length-6)}return tmp}function addTab(array,query,display){const extraClass=display?" active":"";const output=document.createElement("div");if(array.length>0){output.className="search-results "+extraClass;array.forEach(item=>{const name=item.name;const type=itemTypes[item.ty];const longType=longItemTypes[item.ty];const typeName=longType.length!==0?`${longType}`:"?";const link=document.createElement("a");link.className="result-"+type;link.href=item.href;const resultName=document.createElement("div");resultName.className="result-name";resultName.insertAdjacentHTML("beforeend",`${typeName}`);link.appendChild(resultName);let alias=" ";if(item.is_alias){alias=`
\ +${item.alias} - see \ +
`}resultName.insertAdjacentHTML("beforeend",`
${alias}\ +${item.displayPath}${name}\ +
`);const description=document.createElement("div");description.className="desc";description.insertAdjacentHTML("beforeend",item.desc);link.appendChild(description);output.appendChild(link)})}else if(query.error===null){output.className="search-failed"+extraClass;output.innerHTML="No results :(
"+"Try on DuckDuckGo?

"+"Or try looking in one of these:"}return[output,array.length]}function makeTabHeader(tabNb,text,nbElems){const fmtNbElems=nbElems<10?`\u{2007}(${nbElems})\u{2007}\u{2007}`:nbElems<100?`\u{2007}(${nbElems})\u{2007}`:`\u{2007}(${nbElems})`;if(searchState.currentTab===tabNb){return""}return""}function showResults(results,go_to_first,filterCrates){const search=searchState.outputElement();if(go_to_first||(results.others.length===1&&getSettingValue("go-to-only-result")==="true")){window.onunload=()=>{};searchState.removeQueryParameters();const elem=document.createElement("a");elem.href=results.others[0].href;removeClass(elem,"active");document.body.appendChild(elem);elem.click();return}if(results.query===undefined){results.query=parseQuery(searchState.input.value)}currentResults=results.query.userQuery;const ret_others=addTab(results.others,results.query,true);const ret_in_args=addTab(results.in_args,results.query,false);const ret_returned=addTab(results.returned,results.query,false);let currentTab=searchState.currentTab;if((currentTab===0&&ret_others[1]===0)||(currentTab===1&&ret_in_args[1]===0)||(currentTab===2&&ret_returned[1]===0)){if(ret_others[1]!==0){currentTab=0}else if(ret_in_args[1]!==0){currentTab=1}else if(ret_returned[1]!==0){currentTab=2}}let crates="";if(rawSearchIndex.size>1){crates=" in 
"}let output=`

Results${crates}

`;if(results.query.error!==null){const error=results.query.error;error.forEach((value,index)=>{value=value.split("<").join("<").split(">").join(">");if(index%2!==0){error[index]=`${value.replaceAll(" ", " ")}`}else{error[index]=value}});output+=`

Query parser error: "${error.join("")}".

`;output+="
"+makeTabHeader(0,"In Names",ret_others[1])+"
";currentTab=0}else if(results.query.foundElems<=1&&results.query.returned.length===0){output+="
"+makeTabHeader(0,"In Names",ret_others[1])+makeTabHeader(1,"In Parameters",ret_in_args[1])+makeTabHeader(2,"In Return Types",ret_returned[1])+"
"}else{const signatureTabTitle=results.query.elems.length===0?"In Function Return Types":results.query.returned.length===0?"In Function Parameters":"In Function Signatures";output+="
"+makeTabHeader(0,signatureTabTitle,ret_others[1])+"
";currentTab=0}if(results.query.correction!==null){const orig=results.query.returned.length>0?results.query.returned[0].name:results.query.elems[0].name;output+="

"+`Type "${orig}" not found. `+"Showing results for closest type name "+`"${results.query.correction}" instead.

`}if(results.query.proposeCorrectionFrom!==null){const orig=results.query.proposeCorrectionFrom;const targ=results.query.proposeCorrectionTo;output+="

"+`Type "${orig}" not found and used as generic parameter. `+`Consider searching for "${targ}" instead.

`}const resultsElem=document.createElement("div");resultsElem.id="results";resultsElem.appendChild(ret_others[0]);resultsElem.appendChild(ret_in_args[0]);resultsElem.appendChild(ret_returned[0]);search.innerHTML=output;const crateSearch=document.getElementById("crate-search");if(crateSearch){crateSearch.addEventListener("input",updateCrate)}search.appendChild(resultsElem);searchState.showResults(search);const elems=document.getElementById("search-tabs").childNodes;searchState.focusedByTab=[];let i=0;for(const elem of elems){const j=i;elem.onclick=()=>printTab(j);searchState.focusedByTab.push(null);i+=1}printTab(currentTab)}function updateSearchHistory(url){if(!browserSupportsHistoryApi()){return}const params=searchState.getQueryStringParams();if(!history.state&&!params.search){history.pushState(null,"",url)}else{history.replaceState(null,"",url)}}function search(forced){const query=parseQuery(searchState.input.value.trim());let filterCrates=getFilterCrates();if(!forced&&query.userQuery===currentResults){if(query.userQuery.length>0){putBackSearch()}return}searchState.setLoadingSearch();const params=searchState.getQueryStringParams();if(filterCrates===null&¶ms["filter-crate"]!==undefined){filterCrates=params["filter-crate"]}searchState.title="Results for "+query.original+" - Rust";updateSearchHistory(buildUrl(query.original,filterCrates));showResults(execQuery(query,filterCrates,window.currentCrate),params.go_to_first,filterCrates)}function buildItemSearchTypeAll(types,lowercasePaths){return types.length>0?types.map(type=>buildItemSearchType(type,lowercasePaths)):EMPTY_GENERICS_ARRAY}const EMPTY_BINDINGS_MAP=new Map();const EMPTY_GENERICS_ARRAY=[];let TYPES_POOL=new Map();function buildItemSearchType(type,lowercasePaths,isAssocType){const PATH_INDEX_DATA=0;const GENERICS_DATA=1;const BINDINGS_DATA=2;let pathIndex,generics,bindings;if(typeof type==="number"){pathIndex=type;generics=EMPTY_GENERICS_ARRAY;bindings=EMPTY_BINDINGS_MAP}else{pathIndex=type[PATH_INDEX_DATA];generics=buildItemSearchTypeAll(type[GENERICS_DATA],lowercasePaths);if(type.length>BINDINGS_DATA&&type[BINDINGS_DATA].length>0){bindings=new Map(type[BINDINGS_DATA].map(binding=>{const[assocType,constraints]=binding;return[buildItemSearchType(assocType,lowercasePaths,true).id,buildItemSearchTypeAll(constraints,lowercasePaths),]}))}else{bindings=EMPTY_BINDINGS_MAP}}let result;if(pathIndex<0){result={id:pathIndex,ty:TY_GENERIC,path:null,generics,bindings,}}else if(pathIndex===0){result={id:null,ty:null,path:null,generics,bindings,}}else{const item=lowercasePaths[pathIndex-1];result={id:buildTypeMapIndex(item.name,isAssocType),ty:item.ty,path:item.path,generics,bindings,}}const cr=TYPES_POOL.get(result.id);if(cr){if(cr.generics.length===result.generics.length&&cr.generics!==result.generics&&cr.generics.every((x,i)=>result.generics[i]===x)){result.generics=cr.generics}if(cr.bindings.size===result.bindings.size&&cr.bindings!==result.bindings){let ok=true;for(const[k,v]of cr.bindings.entries()){const v2=result.bindings.get(v);if(!v2){ok=false;break}if(v!==v2&&v.length===v2.length&&v.every((x,i)=>v2[i]===x)){result.bindings.set(k,v)}else if(v!==v2){ok=false;break}}if(ok){result.bindings=cr.bindings}}if(cr.ty===result.ty&&cr.path===result.path&&cr.bindings===result.bindings&&cr.generics===result.generics&&cr.ty===result.ty){return cr}}TYPES_POOL.set(result.id,result);return result}function buildFunctionSearchType(itemFunctionDecoder,lowercasePaths){const c=itemFunctionDecoder.string.charCodeAt(itemFunctionDecoder.offset);itemFunctionDecoder.offset+=1;const[zero,ua,la,ob,cb]=["0","@","`","{","}"].map(c=>c.charCodeAt(0));if(c===la){return null}if(c>=zero&&c>1];itemFunctionDecoder.offset+=1;return sign?-value:value}const functionSearchType=decodeList();const INPUTS_DATA=0;const OUTPUT_DATA=1;let inputs,output;if(typeof functionSearchType[INPUTS_DATA]==="number"){inputs=[buildItemSearchType(functionSearchType[INPUTS_DATA],lowercasePaths)]}else{inputs=buildItemSearchTypeAll(functionSearchType[INPUTS_DATA],lowercasePaths)}if(functionSearchType.length>1){if(typeof functionSearchType[OUTPUT_DATA]==="number"){output=[buildItemSearchType(functionSearchType[OUTPUT_DATA],lowercasePaths)]}else{output=buildItemSearchTypeAll(functionSearchType[OUTPUT_DATA],lowercasePaths)}}else{output=[]}const where_clause=[];const l=functionSearchType.length;for(let i=2;i16){itemFunctionDecoder.backrefQueue.pop()}return ret}function buildFunctionTypeFingerprint(type,output,fps){let input=type.id;if(input===typeNameIdOfArray||input===typeNameIdOfSlice){input=typeNameIdOfArrayOrSlice}if(input===typeNameIdOfTuple||input===typeNameIdOfUnit){input=typeNameIdOfTupleOrUnit}if(input===typeNameIdOfFn||input===typeNameIdOfFnMut||input===typeNameIdOfFnOnce){input=typeNameIdOfHof}const hashint1=k=>{k=(~~k+0x7ed55d16)+(k<<12);k=(k ^ 0xc761c23c)^(k>>>19);k=(~~k+0x165667b1)+(k<<5);k=(~~k+0xd3a2646c)^(k<<9);k=(~~k+0xfd7046c5)+(k<<3);return(k ^ 0xb55a4f09)^(k>>>16)};const hashint2=k=>{k=~k+(k<<15);k ^=k>>>12;k+=k<<2;k ^=k>>>4;k=Math.imul(k,2057);return k ^(k>>16)};if(input!==null){const h0a=hashint1(input);const h0b=hashint2(input);const h1a=~~(h0a+Math.imul(h0b,2));const h1b=~~(h0a+Math.imul(h0b,3));const h2a=~~(h0a+Math.imul(h0b,4));const h2b=~~(h0a+Math.imul(h0b,5));output[0]|=(1<<(h0a%32))|(1<<(h1b%32));output[1]|=(1<<(h1a%32))|(1<<(h2b%32));output[2]|=(1<<(h2a%32))|(1<<(h0b%32));fps.add(input)}for(const g of type.generics){buildFunctionTypeFingerprint(g,output,fps)}const fb={id:null,ty:0,generics:EMPTY_GENERICS_ARRAY,bindings:EMPTY_BINDINGS_MAP,};for(const[k,v]of type.bindings.entries()){fb.id=k;fb.generics=v;buildFunctionTypeFingerprint(fb,output,fps)}output[3]=fps.size}function compareTypeFingerprints(fullId,queryFingerprint){const fh0=functionTypeFingerprint[fullId*4];const fh1=functionTypeFingerprint[(fullId*4)+1];const fh2=functionTypeFingerprint[(fullId*4)+2];const[qh0,qh1,qh2]=queryFingerprint;const[in0,in1,in2]=[fh0&qh0,fh1&qh1,fh2&qh2];if((in0 ^ qh0)||(in1 ^ qh1)||(in2 ^ qh2)){return null}return functionTypeFingerprint[(fullId*4)+3]}function buildIndex(rawSearchIndex){searchIndex=[];const charA="A".charCodeAt(0);let currentIndex=0;let id=0;for(const crate of rawSearchIndex.values()){id+=crate.t.length+1}functionTypeFingerprint=new Uint32Array((id+1)*4);id=0;for(const[crate,crateCorpus]of rawSearchIndex){const crateRow={crate:crate,ty:3,name:crate,path:"",desc:crateCorpus.doc,parent:undefined,type:null,id:id,word:crate,normalizedName:crate.indexOf("_")===-1?crate:crate.replace(/_/g,""),deprecated:null,implDisambiguator:null,};id+=1;searchIndex.push(crateRow);currentIndex+=1;const itemTypes=crateCorpus.t;const itemNames=crateCorpus.n;const itemPaths=new Map(crateCorpus.q);const itemDescs=crateCorpus.d;const itemParentIdxs=crateCorpus.i;const itemFunctionDecoder={string:crateCorpus.f,offset:0,backrefQueue:[],};const deprecatedItems=new Set(crateCorpus.c);const implDisambiguator=new Map(crateCorpus.b);const paths=crateCorpus.p;const aliases=crateCorpus.a;const lowercasePaths=[];let len=paths.length;let lastPath=itemPaths.get(0);for(let i=0;i2){path=itemPaths.has(elem[2])?itemPaths.get(elem[2]):lastPath;lastPath=path}lowercasePaths.push({ty:ty,name:name.toLowerCase(),path:path});paths[i]={ty:ty,name:name,path:path}}lastPath="";len=itemTypes.length;for(let i=0;i0?paths[itemParentIdxs[i]-1]:undefined,type,id:id,word,normalizedName:word.indexOf("_")===-1?word:word.replace(/_/g,""),deprecated:deprecatedItems.has(i),implDisambiguator:implDisambiguator.has(i)?implDisambiguator.get(i):null,};id+=1;searchIndex.push(row);lastPath=row.path}if(aliases){const currentCrateAliases=new Map();ALIASES.set(crate,currentCrateAliases);for(const alias_name in aliases){if(!Object.prototype.hasOwnProperty.call(aliases,alias_name)){continue}let currentNameAliases;if(currentCrateAliases.has(alias_name)){currentNameAliases=currentCrateAliases.get(alias_name)}else{currentNameAliases=[];currentCrateAliases.set(alias_name,currentNameAliases)}for(const local_alias of aliases[alias_name]){currentNameAliases.push(local_alias+currentIndex)}}}currentIndex+=itemTypes.length}TYPES_POOL=new Map()}function onSearchSubmit(e){e.preventDefault();searchState.clearInputTimeout();search()}function putBackSearch(){const search_input=searchState.input;if(!searchState.input){return}if(search_input.value!==""&&!searchState.isDisplayed()){searchState.showResults();if(browserSupportsHistoryApi()){history.replaceState(null,"",buildUrl(search_input.value,getFilterCrates()))}document.title=searchState.title}}function registerSearchEvents(){const params=searchState.getQueryStringParams();if(searchState.input.value===""){searchState.input.value=params.search||""}const searchAfter500ms=()=>{searchState.clearInputTimeout();if(searchState.input.value.length===0){searchState.hideResults()}else{searchState.timeout=setTimeout(search,500)}};searchState.input.onkeyup=searchAfter500ms;searchState.input.oninput=searchAfter500ms;document.getElementsByClassName("search-form")[0].onsubmit=onSearchSubmit;searchState.input.onchange=e=>{if(e.target!==document.activeElement){return}searchState.clearInputTimeout();setTimeout(search,0)};searchState.input.onpaste=searchState.input.onchange;searchState.outputElement().addEventListener("keydown",e=>{if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey){return}if(e.which===38){const previous=document.activeElement.previousElementSibling;if(previous){previous.focus()}else{searchState.focus()}e.preventDefault()}else if(e.which===40){const next=document.activeElement.nextElementSibling;if(next){next.focus()}const rect=document.activeElement.getBoundingClientRect();if(window.innerHeight-rect.bottom{if(e.which===40){focusSearchResult();e.preventDefault()}});searchState.input.addEventListener("focus",()=>{putBackSearch()});searchState.input.addEventListener("blur",()=>{searchState.input.placeholder=searchState.input.origPlaceholder});if(browserSupportsHistoryApi()){const previousTitle=document.title;window.addEventListener("popstate",e=>{const params=searchState.getQueryStringParams();document.title=previousTitle;currentResults=null;if(params.search&¶ms.search.length>0){searchState.input.value=params.search;e.preventDefault();search()}else{searchState.input.value="";searchState.hideResults()}})}window.onpageshow=()=>{const qSearch=searchState.getQueryStringParams().search;if(searchState.input.value===""&&qSearch){searchState.input.value=qSearch}search()}}function updateCrate(ev){if(ev.target.value==="all crates"){const query=searchState.input.value.trim();updateSearchHistory(buildUrl(query,null))}currentResults=null;search(true)}buildIndex(rawSearchIndex);if(typeof window!=="undefined"){registerSearchEvents();if(window.searchState.getQueryStringParams().search){search()}}if(typeof exports!=="undefined"){exports.initSearch=initSearch;exports.execQuery=execQuery;exports.parseQuery=parseQuery}}if(typeof window!=="undefined"){window.initSearch=initSearch;if(window.searchIndex!==undefined){initSearch(window.searchIndex)}}else{initSearch(new Map())}})() \ No newline at end of file diff --git a/docs/static.files/settings-4313503d2e1961c2.js b/docs/static.files/settings-4313503d2e1961c2.js new file mode 100644 index 00000000..ab425fe4 --- /dev/null +++ b/docs/static.files/settings-4313503d2e1961c2.js @@ -0,0 +1,17 @@ +"use strict";(function(){const isSettingsPage=window.location.pathname.endsWith("/settings.html");function changeSetting(settingName,value){if(settingName==="theme"){const useSystem=value==="system preference"?"true":"false";updateLocalStorage("use-system-theme",useSystem)}updateLocalStorage(settingName,value);switch(settingName){case"theme":case"preferred-dark-theme":case"preferred-light-theme":updateTheme();updateLightAndDark();break;case"line-numbers":if(value===true){window.rustdoc_add_line_numbers_to_examples()}else{window.rustdoc_remove_line_numbers_from_examples()}break;case"hide-sidebar":if(value===true){addClass(document.documentElement,"hide-sidebar")}else{removeClass(document.documentElement,"hide-sidebar")}break}}function showLightAndDark(){removeClass(document.getElementById("preferred-light-theme"),"hidden");removeClass(document.getElementById("preferred-dark-theme"),"hidden")}function hideLightAndDark(){addClass(document.getElementById("preferred-light-theme"),"hidden");addClass(document.getElementById("preferred-dark-theme"),"hidden")}function updateLightAndDark(){const useSystem=getSettingValue("use-system-theme");if(useSystem==="true"||(useSystem===null&&getSettingValue("theme")===null)){showLightAndDark()}else{hideLightAndDark()}}function setEvents(settingsElement){updateLightAndDark();onEachLazy(settingsElement.querySelectorAll("input[type=\"checkbox\"]"),toggle=>{const settingId=toggle.id;const settingValue=getSettingValue(settingId);if(settingValue!==null){toggle.checked=settingValue==="true"}toggle.onchange=()=>{changeSetting(toggle.id,toggle.checked)}});onEachLazy(settingsElement.querySelectorAll("input[type=\"radio\"]"),elem=>{const settingId=elem.name;let settingValue=getSettingValue(settingId);if(settingId==="theme"){const useSystem=getSettingValue("use-system-theme");if(useSystem==="true"||settingValue===null){settingValue=useSystem==="false"?"light":"system preference"}}if(settingValue!==null&&settingValue!=="null"){elem.checked=settingValue===elem.value}elem.addEventListener("change",ev=>{changeSetting(ev.target.name,ev.target.value)})})}function buildSettingsPageSections(settings){let output="";for(const setting of settings){const js_data_name=setting["js_name"];const setting_name=setting["name"];if(setting["options"]!==undefined){output+=`\ +
+
${setting_name}
+
`;onEach(setting["options"],option=>{const checked=option===setting["default"]?" checked":"";const full=`${js_data_name}-${option.replace(/ /g,"-")}`;output+=`\ + `});output+=`\ +
+
`}else{const checked=setting["default"]===true?" checked":"";output+=`\ +
\ + \ +
`}}return output}function buildSettingsPage(){const theme_names=getVar("themes").split(",").filter(t=>t);theme_names.push("light","dark","ayu");const settings=[{"name":"Theme","js_name":"theme","default":"system preference","options":theme_names.concat("system preference"),},{"name":"Preferred light theme","js_name":"preferred-light-theme","default":"light","options":theme_names,},{"name":"Preferred dark theme","js_name":"preferred-dark-theme","default":"dark","options":theme_names,},{"name":"Auto-hide item contents for large items","js_name":"auto-hide-large-items","default":true,},{"name":"Auto-hide item methods' documentation","js_name":"auto-hide-method-docs","default":false,},{"name":"Auto-hide trait implementation documentation","js_name":"auto-hide-trait-implementations","default":false,},{"name":"Directly go to item in search if there is only one result","js_name":"go-to-only-result","default":false,},{"name":"Show line numbers on code examples","js_name":"line-numbers","default":false,},{"name":"Hide persistent navigation bar","js_name":"hide-sidebar","default":false,},{"name":"Disable keyboard shortcuts","js_name":"disable-shortcuts","default":false,},];const elementKind=isSettingsPage?"section":"div";const innerHTML=`
${buildSettingsPageSections(settings)}
`;const el=document.createElement(elementKind);el.id="settings";if(!isSettingsPage){el.className="popover"}el.innerHTML=innerHTML;if(isSettingsPage){document.getElementById(MAIN_ID).appendChild(el)}else{el.setAttribute("tabindex","-1");getSettingsButton().appendChild(el)}return el}const settingsMenu=buildSettingsPage();function displaySettings(){settingsMenu.style.display="";onEachLazy(settingsMenu.querySelectorAll("input[type='checkbox']"),el=>{const val=getSettingValue(el.id);const checked=val==="true";if(checked!==el.checked&&val!==null){el.checked=checked}})}function settingsBlurHandler(event){blurHandler(event,getSettingsButton(),window.hidePopoverMenus)}if(isSettingsPage){getSettingsButton().onclick=event=>{event.preventDefault()}}else{const settingsButton=getSettingsButton();const settingsMenu=document.getElementById("settings");settingsButton.onclick=event=>{if(settingsMenu.contains(event.target)){return}event.preventDefault();const shouldDisplaySettings=settingsMenu.style.display==="none";window.hideAllModals();if(shouldDisplaySettings){displaySettings()}};settingsButton.onblur=settingsBlurHandler;settingsButton.querySelector("a").onblur=settingsBlurHandler;onEachLazy(settingsMenu.querySelectorAll("input"),el=>{el.onblur=settingsBlurHandler});settingsMenu.onblur=settingsBlurHandler}setTimeout(()=>{setEvents(settingsMenu);if(!isSettingsPage){displaySettings()}removeClass(getSettingsButton(),"rotate")},0)})() \ No newline at end of file diff --git a/docs/static.files/src-script-e66d777a5a92e9b2.js b/docs/static.files/src-script-e66d777a5a92e9b2.js new file mode 100644 index 00000000..d0aebb85 --- /dev/null +++ b/docs/static.files/src-script-e66d777a5a92e9b2.js @@ -0,0 +1 @@ +"use strict";(function(){const rootPath=getVar("root-path");const NAME_OFFSET=0;const DIRS_OFFSET=1;const FILES_OFFSET=2;const RUSTDOC_MOBILE_BREAKPOINT=700;function closeSidebarIfMobile(){if(window.innerWidth{removeClass(document.documentElement,"src-sidebar-expanded");updateLocalStorage("source-sidebar-show","false")};window.rustdocShowSourceSidebar=()=>{addClass(document.documentElement,"src-sidebar-expanded");updateLocalStorage("source-sidebar-show","true")};window.rustdocToggleSrcSidebar=()=>{if(document.documentElement.classList.contains("src-sidebar-expanded")){window.rustdocCloseSourceSidebar()}else{window.rustdocShowSourceSidebar()}};function createSrcSidebar(){const container=document.querySelector("nav.sidebar");const sidebar=document.createElement("div");sidebar.id="src-sidebar";let hasFoundFile=false;for(const[key,source]of srcIndex){source[NAME_OFFSET]=key;hasFoundFile=createDirEntry(source,sidebar,"",hasFoundFile)}container.appendChild(sidebar);const selected_elem=sidebar.getElementsByClassName("selected")[0];if(typeof selected_elem!=="undefined"){selected_elem.focus()}}function highlightSrcLines(){const match=window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/);if(!match){return}let from=parseInt(match[1],10);let to=from;if(typeof match[2]!=="undefined"){to=parseInt(match[2],10)}if(to{onEachLazy(e.getElementsByTagName("a"),i_e=>{removeClass(i_e,"line-highlighted")})});for(let i=from;i<=to;++i){elem=document.getElementById(i);if(!elem){break}addClass(elem,"line-highlighted")}}const handleSrcHighlight=(function(){let prev_line_id=0;const set_fragment=name=>{const x=window.scrollX,y=window.scrollY;if(browserSupportsHistoryApi()){history.replaceState(null,null,"#"+name);highlightSrcLines()}else{location.replace("#"+name)}window.scrollTo(x,y)};return ev=>{let cur_line_id=parseInt(ev.target.id,10);if(isNaN(cur_line_id)||ev.ctrlKey||ev.altKey||ev.metaKey){return}ev.preventDefault();if(ev.shiftKey&&prev_line_id){if(prev_line_id>cur_line_id){const tmp=prev_line_id;prev_line_id=cur_line_id;cur_line_id=tmp}set_fragment(prev_line_id+"-"+cur_line_id)}else{prev_line_id=cur_line_id;set_fragment(cur_line_id)}}}());window.addEventListener("hashchange",highlightSrcLines);onEachLazy(document.getElementsByClassName("src-line-numbers"),el=>{el.addEventListener("click",handleSrcHighlight)});highlightSrcLines();window.createSrcSidebar=createSrcSidebar})() \ No newline at end of file diff --git a/docs/static.files/storage-4c98445ec4002617.js b/docs/static.files/storage-4c98445ec4002617.js new file mode 100644 index 00000000..b378b856 --- /dev/null +++ b/docs/static.files/storage-4c98445ec4002617.js @@ -0,0 +1 @@ +"use strict";const builtinThemes=["light","dark","ayu"];const darkThemes=["dark","ayu"];window.currentTheme=document.getElementById("themeStyle");const settingsDataset=(function(){const settingsElement=document.getElementById("default-settings");return settingsElement&&settingsElement.dataset?settingsElement.dataset:null})();function getSettingValue(settingName){const current=getCurrentValue(settingName);if(current===null&&settingsDataset!==null){const def=settingsDataset[settingName.replace(/-/g,"_")];if(def!==undefined){return def}}return current}const localStoredTheme=getSettingValue("theme");function hasClass(elem,className){return elem&&elem.classList&&elem.classList.contains(className)}function addClass(elem,className){if(elem&&elem.classList){elem.classList.add(className)}}function removeClass(elem,className){if(elem&&elem.classList){elem.classList.remove(className)}}function onEach(arr,func){for(const elem of arr){if(func(elem)){return true}}return false}function onEachLazy(lazyArray,func){return onEach(Array.prototype.slice.call(lazyArray),func)}function updateLocalStorage(name,value){try{window.localStorage.setItem("rustdoc-"+name,value)}catch(e){}}function getCurrentValue(name){try{return window.localStorage.getItem("rustdoc-"+name)}catch(e){return null}}const getVar=(function getVar(name){const el=document.querySelector("head > meta[name='rustdoc-vars']");return el?el.attributes["data-"+name].value:null});function switchTheme(newThemeName,saveTheme){const themeNames=getVar("themes").split(",").filter(t=>t);themeNames.push(...builtinThemes);if(themeNames.indexOf(newThemeName)===-1){return}if(saveTheme){updateLocalStorage("theme",newThemeName)}document.documentElement.setAttribute("data-theme",newThemeName);if(builtinThemes.indexOf(newThemeName)!==-1){if(window.currentTheme){window.currentTheme.parentNode.removeChild(window.currentTheme);window.currentTheme=null}}else{const newHref=getVar("root-path")+encodeURIComponent(newThemeName)+getVar("resource-suffix")+".css";if(!window.currentTheme){if(document.readyState==="loading"){document.write(``);window.currentTheme=document.getElementById("themeStyle")}else{window.currentTheme=document.createElement("link");window.currentTheme.rel="stylesheet";window.currentTheme.id="themeStyle";window.currentTheme.href=newHref;document.documentElement.appendChild(window.currentTheme)}}else if(newHref!==window.currentTheme.href){window.currentTheme.href=newHref}}}const updateTheme=(function(){const mql=window.matchMedia("(prefers-color-scheme: dark)");function updateTheme(){if(getSettingValue("use-system-theme")!=="false"){const lightTheme=getSettingValue("preferred-light-theme")||"light";const darkTheme=getSettingValue("preferred-dark-theme")||"dark";updateLocalStorage("use-system-theme","true");switchTheme(mql.matches?darkTheme:lightTheme,true)}else{switchTheme(getSettingValue("theme"),false)}}mql.addEventListener("change",updateTheme);return updateTheme})();if(getSettingValue("use-system-theme")!=="false"&&window.matchMedia){if(getSettingValue("use-system-theme")===null&&getSettingValue("preferred-dark-theme")===null&&darkThemes.indexOf(localStoredTheme)>=0){updateLocalStorage("preferred-dark-theme",localStoredTheme)}}updateTheme();if(getSettingValue("source-sidebar-show")==="true"){addClass(document.documentElement,"src-sidebar-expanded")}if(getSettingValue("hide-sidebar")==="true"){addClass(document.documentElement,"hide-sidebar")}function updateSidebarWidth(){const desktopSidebarWidth=getSettingValue("desktop-sidebar-width");if(desktopSidebarWidth&&desktopSidebarWidth!=="null"){document.documentElement.style.setProperty("--desktop-sidebar-width",desktopSidebarWidth+"px")}const srcSidebarWidth=getSettingValue("src-sidebar-width");if(srcSidebarWidth&&srcSidebarWidth!=="null"){document.documentElement.style.setProperty("--src-sidebar-width",srcSidebarWidth+"px")}}updateSidebarWidth();window.addEventListener("pageshow",ev=>{if(ev.persisted){setTimeout(updateTheme,0);setTimeout(updateSidebarWidth,0)}}) \ No newline at end of file diff --git a/docs/static.files/wheel-7b819b6101059cd0.svg b/docs/static.files/wheel-7b819b6101059cd0.svg new file mode 100644 index 00000000..83c07f63 --- /dev/null +++ b/docs/static.files/wheel-7b819b6101059cd0.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/trait.impl/bitflags/traits/trait.Flags.js b/docs/trait.impl/bitflags/traits/trait.Flags.js new file mode 100644 index 00000000..e9bd7e5c --- /dev/null +++ b/docs/trait.impl/bitflags/traits/trait.Flags.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Flags for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/bitflags/traits/trait.PublicFlags.js b/docs/trait.impl/bitflags/traits/trait.PublicFlags.js new file mode 100644 index 00000000..79aeefec --- /dev/null +++ b/docs/trait.impl/bitflags/traits/trait.PublicFlags.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl PublicFlags for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/clone/trait.Clone.js b/docs/trait.impl/core/clone/trait.Clone.js new file mode 100644 index 00000000..6f60c8a4 --- /dev/null +++ b/docs/trait.impl/core/clone/trait.Clone.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Clone for Direction"],["impl Clone for File"],["impl Clone for PieceKind"],["impl Clone for Player"],["impl Clone for Promotion"],["impl Clone for Rank"],["impl Clone for Square"],["impl Clone for Bitboard"],["impl Clone for Board"],["impl Clone for Pieces"],["impl Clone for CastleRights"],["impl Clone for DirectionIter"],["impl Clone for FileIter"],["impl Clone for Move"],["impl Clone for RankIter"],["impl Clone for SquareIter"],["impl Clone for Position"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/cmp/trait.Eq.js b/docs/trait.impl/core/cmp/trait.Eq.js new file mode 100644 index 00000000..0f0e58f2 --- /dev/null +++ b/docs/trait.impl/core/cmp/trait.Eq.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Eq for File"],["impl Eq for Player"],["impl Eq for Rank"],["impl Eq for Square"],["impl Eq for Bitboard"],["impl Eq for Board"],["impl Eq for Pieces"],["impl Eq for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/cmp/trait.Ord.js b/docs/trait.impl/core/cmp/trait.Ord.js new file mode 100644 index 00000000..109f1d07 --- /dev/null +++ b/docs/trait.impl/core/cmp/trait.Ord.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Ord for File"],["impl Ord for Rank"],["impl Ord for Square"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/cmp/trait.PartialEq.js b/docs/trait.impl/core/cmp/trait.PartialEq.js new file mode 100644 index 00000000..bb9736b4 --- /dev/null +++ b/docs/trait.impl/core/cmp/trait.PartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl PartialEq for File"],["impl PartialEq for PieceKind"],["impl PartialEq for Player"],["impl PartialEq for Promotion"],["impl PartialEq for Rank"],["impl PartialEq for Square"],["impl PartialEq for Bitboard"],["impl PartialEq for Board"],["impl PartialEq for Pieces"],["impl PartialEq for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/cmp/trait.PartialOrd.js b/docs/trait.impl/core/cmp/trait.PartialOrd.js new file mode 100644 index 00000000..33a4aea5 --- /dev/null +++ b/docs/trait.impl/core/cmp/trait.PartialOrd.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl PartialOrd for File"],["impl PartialOrd for PieceKind"],["impl PartialOrd for Promotion"],["impl PartialOrd for Rank"],["impl PartialOrd for Square"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/convert/trait.From.js b/docs/trait.impl/core/convert/trait.From.js new file mode 100644 index 00000000..028e87c0 --- /dev/null +++ b/docs/trait.impl/core/convert/trait.From.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl From<Promotion> for PieceKind"],["impl From<Square> for Bitboard"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/convert/trait.TryFrom.js b/docs/trait.impl/core/convert/trait.TryFrom.js new file mode 100644 index 00000000..380abad7 --- /dev/null +++ b/docs/trait.impl/core/convert/trait.TryFrom.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl TryFrom<&str> for Player"],["impl TryFrom<&str> for Square"],["impl TryFrom<&str> for CastleRights"],["impl TryFrom<&str> for Position"],["impl TryFrom<char> for File"],["impl TryFrom<char> for Rank"],["impl TryFrom<char> for Piece"],["impl TryFrom<u8> for File"],["impl TryFrom<u8> for Rank"],["impl TryFrom<u8> for Square"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/convert/trait.TryInto.js b/docs/trait.impl/core/convert/trait.TryInto.js new file mode 100644 index 00000000..c95ed11c --- /dev/null +++ b/docs/trait.impl/core/convert/trait.TryInto.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl TryInto<Square> for Bitboard"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/fmt/trait.Binary.js b/docs/trait.impl/core/fmt/trait.Binary.js new file mode 100644 index 00000000..ce492935 --- /dev/null +++ b/docs/trait.impl/core/fmt/trait.Binary.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Binary for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/fmt/trait.Debug.js b/docs/trait.impl/core/fmt/trait.Debug.js new file mode 100644 index 00000000..ea991e80 --- /dev/null +++ b/docs/trait.impl/core/fmt/trait.Debug.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Debug for Direction"],["impl Debug for File"],["impl Debug for PieceKind"],["impl Debug for Player"],["impl Debug for Promotion"],["impl Debug for Rank"],["impl Debug for Square"],["impl Debug for AttackInfo"],["impl Debug for Bitboard"],["impl Debug for Board"],["impl Debug for CastleRights"],["impl Debug for DirectionIter"],["impl Debug for FileIter"],["impl Debug for Move"],["impl Debug for RankIter"],["impl Debug for SquareIter"],["impl Debug for Position"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/fmt/trait.Display.js b/docs/trait.impl/core/fmt/trait.Display.js new file mode 100644 index 00000000..7033b243 --- /dev/null +++ b/docs/trait.impl/core/fmt/trait.Display.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Display for File"],["impl Display for PieceKind"],["impl Display for Player"],["impl Display for Rank"],["impl Display for Square"],["impl Display for Board"],["impl Display for CastleRights"],["impl Display for Move"],["impl Display for Piece"],["impl Display for Position"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/fmt/trait.LowerHex.js b/docs/trait.impl/core/fmt/trait.LowerHex.js new file mode 100644 index 00000000..4e6309fc --- /dev/null +++ b/docs/trait.impl/core/fmt/trait.LowerHex.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl LowerHex for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/fmt/trait.Octal.js b/docs/trait.impl/core/fmt/trait.Octal.js new file mode 100644 index 00000000..596f669b --- /dev/null +++ b/docs/trait.impl/core/fmt/trait.Octal.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Octal for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/fmt/trait.UpperHex.js b/docs/trait.impl/core/fmt/trait.UpperHex.js new file mode 100644 index 00000000..68551c69 --- /dev/null +++ b/docs/trait.impl/core/fmt/trait.UpperHex.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl UpperHex for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/hash/trait.Hash.js b/docs/trait.impl/core/hash/trait.Hash.js new file mode 100644 index 00000000..65a651fd --- /dev/null +++ b/docs/trait.impl/core/hash/trait.Hash.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Hash for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/iter/traits/collect/trait.Extend.js b/docs/trait.impl/core/iter/traits/collect/trait.Extend.js new file mode 100644 index 00000000..cc8016de --- /dev/null +++ b/docs/trait.impl/core/iter/traits/collect/trait.Extend.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Extend<CastleRights> for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js b/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js new file mode 100644 index 00000000..98fecfd1 --- /dev/null +++ b/docs/trait.impl/core/iter/traits/collect/trait.FromIterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl FromIterator<CastleRights> for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/iter/traits/collect/trait.IntoIterator.js b/docs/trait.impl/core/iter/traits/collect/trait.IntoIterator.js new file mode 100644 index 00000000..8cd05eee --- /dev/null +++ b/docs/trait.impl/core/iter/traits/collect/trait.IntoIterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl IntoIterator for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/iter/traits/double_ended/trait.DoubleEndedIterator.js b/docs/trait.impl/core/iter/traits/double_ended/trait.DoubleEndedIterator.js new file mode 100644 index 00000000..d435932b --- /dev/null +++ b/docs/trait.impl/core/iter/traits/double_ended/trait.DoubleEndedIterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl DoubleEndedIterator for DirectionIter"],["impl DoubleEndedIterator for FileIter"],["impl DoubleEndedIterator for RankIter"],["impl DoubleEndedIterator for SquareIter"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/iter/traits/exact_size/trait.ExactSizeIterator.js b/docs/trait.impl/core/iter/traits/exact_size/trait.ExactSizeIterator.js new file mode 100644 index 00000000..b46610ac --- /dev/null +++ b/docs/trait.impl/core/iter/traits/exact_size/trait.ExactSizeIterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl ExactSizeIterator for BitboardIterator"],["impl ExactSizeIterator for DirectionIter"],["impl ExactSizeIterator for FileIter"],["impl ExactSizeIterator for RankIter"],["impl ExactSizeIterator for SquareIter"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/iter/traits/iterator/trait.Iterator.js b/docs/trait.impl/core/iter/traits/iterator/trait.Iterator.js new file mode 100644 index 00000000..0c144a02 --- /dev/null +++ b/docs/trait.impl/core/iter/traits/iterator/trait.Iterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Iterator for BitboardIterator"],["impl Iterator for DirectionIter"],["impl Iterator for FileIter"],["impl Iterator for RankIter"],["impl Iterator for SquareIter"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/iter/traits/marker/trait.FusedIterator.js b/docs/trait.impl/core/iter/traits/marker/trait.FusedIterator.js new file mode 100644 index 00000000..ea6d8897 --- /dev/null +++ b/docs/trait.impl/core/iter/traits/marker/trait.FusedIterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl FusedIterator for DirectionIter"],["impl FusedIterator for FileIter"],["impl FusedIterator for RankIter"],["impl FusedIterator for SquareIter"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/marker/trait.Copy.js b/docs/trait.impl/core/marker/trait.Copy.js new file mode 100644 index 00000000..8c7ae24a --- /dev/null +++ b/docs/trait.impl/core/marker/trait.Copy.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Copy for Direction"],["impl Copy for File"],["impl Copy for PieceKind"],["impl Copy for Player"],["impl Copy for Promotion"],["impl Copy for Rank"],["impl Copy for Square"],["impl Copy for Bitboard"],["impl Copy for CastleRights"],["impl Copy for Move"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/marker/trait.Freeze.js b/docs/trait.impl/core/marker/trait.Freeze.js new file mode 100644 index 00000000..e0a76292 --- /dev/null +++ b/docs/trait.impl/core/marker/trait.Freeze.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Freeze for Direction",1,["pabi::chess::core::Direction"]],["impl Freeze for File",1,["pabi::chess::core::File"]],["impl Freeze for PieceKind",1,["pabi::chess::core::PieceKind"]],["impl Freeze for Player",1,["pabi::chess::core::Player"]],["impl Freeze for Promotion",1,["pabi::chess::core::Promotion"]],["impl Freeze for Rank",1,["pabi::chess::core::Rank"]],["impl Freeze for Square",1,["pabi::chess::core::Square"]],["impl Freeze for AttackInfo",1,["pabi::chess::attacks::AttackInfo"]],["impl Freeze for Bitboard",1,["pabi::chess::bitboard::Bitboard"]],["impl Freeze for BitboardIterator",1,["pabi::chess::bitboard::BitboardIterator"]],["impl Freeze for Board",1,["pabi::chess::bitboard::Board"]],["impl Freeze for Pieces",1,["pabi::chess::bitboard::Pieces"]],["impl Freeze for CastleRights",1,["pabi::chess::core::CastleRights"]],["impl Freeze for DirectionIter",1,["pabi::chess::core::DirectionIter"]],["impl Freeze for FileIter",1,["pabi::chess::core::FileIter"]],["impl Freeze for Move",1,["pabi::chess::core::Move"]],["impl Freeze for Piece",1,["pabi::chess::core::Piece"]],["impl Freeze for RankIter",1,["pabi::chess::core::RankIter"]],["impl Freeze for SquareIter",1,["pabi::chess::core::SquareIter"]],["impl Freeze for Position",1,["pabi::chess::position::Position"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/marker/trait.Send.js b/docs/trait.impl/core/marker/trait.Send.js new file mode 100644 index 00000000..9a36bd9b --- /dev/null +++ b/docs/trait.impl/core/marker/trait.Send.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Send for Direction",1,["pabi::chess::core::Direction"]],["impl Send for File",1,["pabi::chess::core::File"]],["impl Send for PieceKind",1,["pabi::chess::core::PieceKind"]],["impl Send for Player",1,["pabi::chess::core::Player"]],["impl Send for Promotion",1,["pabi::chess::core::Promotion"]],["impl Send for Rank",1,["pabi::chess::core::Rank"]],["impl Send for Square",1,["pabi::chess::core::Square"]],["impl Send for AttackInfo",1,["pabi::chess::attacks::AttackInfo"]],["impl Send for Bitboard",1,["pabi::chess::bitboard::Bitboard"]],["impl Send for BitboardIterator",1,["pabi::chess::bitboard::BitboardIterator"]],["impl Send for Board",1,["pabi::chess::bitboard::Board"]],["impl Send for Pieces",1,["pabi::chess::bitboard::Pieces"]],["impl Send for CastleRights",1,["pabi::chess::core::CastleRights"]],["impl Send for DirectionIter",1,["pabi::chess::core::DirectionIter"]],["impl Send for FileIter",1,["pabi::chess::core::FileIter"]],["impl Send for Move",1,["pabi::chess::core::Move"]],["impl Send for Piece",1,["pabi::chess::core::Piece"]],["impl Send for RankIter",1,["pabi::chess::core::RankIter"]],["impl Send for SquareIter",1,["pabi::chess::core::SquareIter"]],["impl Send for Position",1,["pabi::chess::position::Position"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/marker/trait.StructuralPartialEq.js b/docs/trait.impl/core/marker/trait.StructuralPartialEq.js new file mode 100644 index 00000000..b65e43bf --- /dev/null +++ b/docs/trait.impl/core/marker/trait.StructuralPartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl StructuralPartialEq for File"],["impl StructuralPartialEq for PieceKind"],["impl StructuralPartialEq for Player"],["impl StructuralPartialEq for Promotion"],["impl StructuralPartialEq for Rank"],["impl StructuralPartialEq for Square"],["impl StructuralPartialEq for Bitboard"],["impl StructuralPartialEq for Board"],["impl StructuralPartialEq for Pieces"],["impl StructuralPartialEq for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/marker/trait.Sync.js b/docs/trait.impl/core/marker/trait.Sync.js new file mode 100644 index 00000000..7cc772cf --- /dev/null +++ b/docs/trait.impl/core/marker/trait.Sync.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Sync for Direction",1,["pabi::chess::core::Direction"]],["impl Sync for File",1,["pabi::chess::core::File"]],["impl Sync for PieceKind",1,["pabi::chess::core::PieceKind"]],["impl Sync for Player",1,["pabi::chess::core::Player"]],["impl Sync for Promotion",1,["pabi::chess::core::Promotion"]],["impl Sync for Rank",1,["pabi::chess::core::Rank"]],["impl Sync for Square",1,["pabi::chess::core::Square"]],["impl Sync for AttackInfo",1,["pabi::chess::attacks::AttackInfo"]],["impl Sync for Bitboard",1,["pabi::chess::bitboard::Bitboard"]],["impl Sync for BitboardIterator",1,["pabi::chess::bitboard::BitboardIterator"]],["impl Sync for Board",1,["pabi::chess::bitboard::Board"]],["impl Sync for Pieces",1,["pabi::chess::bitboard::Pieces"]],["impl Sync for CastleRights",1,["pabi::chess::core::CastleRights"]],["impl Sync for DirectionIter",1,["pabi::chess::core::DirectionIter"]],["impl Sync for FileIter",1,["pabi::chess::core::FileIter"]],["impl Sync for Move",1,["pabi::chess::core::Move"]],["impl Sync for Piece",1,["pabi::chess::core::Piece"]],["impl Sync for RankIter",1,["pabi::chess::core::RankIter"]],["impl Sync for SquareIter",1,["pabi::chess::core::SquareIter"]],["impl Sync for Position",1,["pabi::chess::position::Position"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/marker/trait.Unpin.js b/docs/trait.impl/core/marker/trait.Unpin.js new file mode 100644 index 00000000..dd951b26 --- /dev/null +++ b/docs/trait.impl/core/marker/trait.Unpin.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Unpin for Direction",1,["pabi::chess::core::Direction"]],["impl Unpin for File",1,["pabi::chess::core::File"]],["impl Unpin for PieceKind",1,["pabi::chess::core::PieceKind"]],["impl Unpin for Player",1,["pabi::chess::core::Player"]],["impl Unpin for Promotion",1,["pabi::chess::core::Promotion"]],["impl Unpin for Rank",1,["pabi::chess::core::Rank"]],["impl Unpin for Square",1,["pabi::chess::core::Square"]],["impl Unpin for AttackInfo",1,["pabi::chess::attacks::AttackInfo"]],["impl Unpin for Bitboard",1,["pabi::chess::bitboard::Bitboard"]],["impl Unpin for BitboardIterator",1,["pabi::chess::bitboard::BitboardIterator"]],["impl Unpin for Board",1,["pabi::chess::bitboard::Board"]],["impl Unpin for Pieces",1,["pabi::chess::bitboard::Pieces"]],["impl Unpin for CastleRights",1,["pabi::chess::core::CastleRights"]],["impl Unpin for DirectionIter",1,["pabi::chess::core::DirectionIter"]],["impl Unpin for FileIter",1,["pabi::chess::core::FileIter"]],["impl Unpin for Move",1,["pabi::chess::core::Move"]],["impl Unpin for Piece",1,["pabi::chess::core::Piece"]],["impl Unpin for RankIter",1,["pabi::chess::core::RankIter"]],["impl Unpin for SquareIter",1,["pabi::chess::core::SquareIter"]],["impl Unpin for Position",1,["pabi::chess::position::Position"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/ops/arith/trait.Sub.js b/docs/trait.impl/core/ops/arith/trait.Sub.js new file mode 100644 index 00000000..4e5e6bde --- /dev/null +++ b/docs/trait.impl/core/ops/arith/trait.Sub.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Sub for Bitboard"],["impl Sub for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/ops/arith/trait.SubAssign.js b/docs/trait.impl/core/ops/arith/trait.SubAssign.js new file mode 100644 index 00000000..02db6ec0 --- /dev/null +++ b/docs/trait.impl/core/ops/arith/trait.SubAssign.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl SubAssign for Bitboard"],["impl SubAssign for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/ops/bit/trait.BitAnd.js b/docs/trait.impl/core/ops/bit/trait.BitAnd.js new file mode 100644 index 00000000..0eba16e9 --- /dev/null +++ b/docs/trait.impl/core/ops/bit/trait.BitAnd.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl BitAnd for Bitboard"],["impl BitAnd for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/ops/bit/trait.BitAndAssign.js b/docs/trait.impl/core/ops/bit/trait.BitAndAssign.js new file mode 100644 index 00000000..c4f95fc3 --- /dev/null +++ b/docs/trait.impl/core/ops/bit/trait.BitAndAssign.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl BitAndAssign for Bitboard"],["impl BitAndAssign for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/ops/bit/trait.BitOr.js b/docs/trait.impl/core/ops/bit/trait.BitOr.js new file mode 100644 index 00000000..1c58582c --- /dev/null +++ b/docs/trait.impl/core/ops/bit/trait.BitOr.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl BitOr for Bitboard"],["impl BitOr for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/ops/bit/trait.BitOrAssign.js b/docs/trait.impl/core/ops/bit/trait.BitOrAssign.js new file mode 100644 index 00000000..b9ba3b82 --- /dev/null +++ b/docs/trait.impl/core/ops/bit/trait.BitOrAssign.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl BitOrAssign for Bitboard"],["impl BitOrAssign for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/ops/bit/trait.BitXor.js b/docs/trait.impl/core/ops/bit/trait.BitXor.js new file mode 100644 index 00000000..be526292 --- /dev/null +++ b/docs/trait.impl/core/ops/bit/trait.BitXor.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl BitXor for Bitboard"],["impl BitXor for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/ops/bit/trait.BitXorAssign.js b/docs/trait.impl/core/ops/bit/trait.BitXorAssign.js new file mode 100644 index 00000000..a94f7da4 --- /dev/null +++ b/docs/trait.impl/core/ops/bit/trait.BitXorAssign.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl BitXorAssign for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/ops/bit/trait.Not.js b/docs/trait.impl/core/ops/bit/trait.Not.js new file mode 100644 index 00000000..4b6ca99f --- /dev/null +++ b/docs/trait.impl/core/ops/bit/trait.Not.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Not for Bitboard"],["impl Not for CastleRights"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/ops/bit/trait.Shl.js b/docs/trait.impl/core/ops/bit/trait.Shl.js new file mode 100644 index 00000000..ed2f67da --- /dev/null +++ b/docs/trait.impl/core/ops/bit/trait.Shl.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Shl<u32> for Bitboard"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/ops/bit/trait.Shr.js b/docs/trait.impl/core/ops/bit/trait.Shr.js new file mode 100644 index 00000000..31788761 --- /dev/null +++ b/docs/trait.impl/core/ops/bit/trait.Shr.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl Shr<u32> for Bitboard"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/panic/unwind_safe/trait.RefUnwindSafe.js b/docs/trait.impl/core/panic/unwind_safe/trait.RefUnwindSafe.js new file mode 100644 index 00000000..be065bb4 --- /dev/null +++ b/docs/trait.impl/core/panic/unwind_safe/trait.RefUnwindSafe.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl RefUnwindSafe for Direction",1,["pabi::chess::core::Direction"]],["impl RefUnwindSafe for File",1,["pabi::chess::core::File"]],["impl RefUnwindSafe for PieceKind",1,["pabi::chess::core::PieceKind"]],["impl RefUnwindSafe for Player",1,["pabi::chess::core::Player"]],["impl RefUnwindSafe for Promotion",1,["pabi::chess::core::Promotion"]],["impl RefUnwindSafe for Rank",1,["pabi::chess::core::Rank"]],["impl RefUnwindSafe for Square",1,["pabi::chess::core::Square"]],["impl RefUnwindSafe for AttackInfo",1,["pabi::chess::attacks::AttackInfo"]],["impl RefUnwindSafe for Bitboard",1,["pabi::chess::bitboard::Bitboard"]],["impl RefUnwindSafe for BitboardIterator",1,["pabi::chess::bitboard::BitboardIterator"]],["impl RefUnwindSafe for Board",1,["pabi::chess::bitboard::Board"]],["impl RefUnwindSafe for Pieces",1,["pabi::chess::bitboard::Pieces"]],["impl RefUnwindSafe for CastleRights",1,["pabi::chess::core::CastleRights"]],["impl RefUnwindSafe for DirectionIter",1,["pabi::chess::core::DirectionIter"]],["impl RefUnwindSafe for FileIter",1,["pabi::chess::core::FileIter"]],["impl RefUnwindSafe for Move",1,["pabi::chess::core::Move"]],["impl RefUnwindSafe for Piece",1,["pabi::chess::core::Piece"]],["impl RefUnwindSafe for RankIter",1,["pabi::chess::core::RankIter"]],["impl RefUnwindSafe for SquareIter",1,["pabi::chess::core::SquareIter"]],["impl RefUnwindSafe for Position",1,["pabi::chess::position::Position"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/core/panic/unwind_safe/trait.UnwindSafe.js b/docs/trait.impl/core/panic/unwind_safe/trait.UnwindSafe.js new file mode 100644 index 00000000..c2887145 --- /dev/null +++ b/docs/trait.impl/core/panic/unwind_safe/trait.UnwindSafe.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl UnwindSafe for Direction",1,["pabi::chess::core::Direction"]],["impl UnwindSafe for File",1,["pabi::chess::core::File"]],["impl UnwindSafe for PieceKind",1,["pabi::chess::core::PieceKind"]],["impl UnwindSafe for Player",1,["pabi::chess::core::Player"]],["impl UnwindSafe for Promotion",1,["pabi::chess::core::Promotion"]],["impl UnwindSafe for Rank",1,["pabi::chess::core::Rank"]],["impl UnwindSafe for Square",1,["pabi::chess::core::Square"]],["impl UnwindSafe for AttackInfo",1,["pabi::chess::attacks::AttackInfo"]],["impl UnwindSafe for Bitboard",1,["pabi::chess::bitboard::Bitboard"]],["impl UnwindSafe for BitboardIterator",1,["pabi::chess::bitboard::BitboardIterator"]],["impl UnwindSafe for Board",1,["pabi::chess::bitboard::Board"]],["impl UnwindSafe for Pieces",1,["pabi::chess::bitboard::Pieces"]],["impl UnwindSafe for CastleRights",1,["pabi::chess::core::CastleRights"]],["impl UnwindSafe for DirectionIter",1,["pabi::chess::core::DirectionIter"]],["impl UnwindSafe for FileIter",1,["pabi::chess::core::FileIter"]],["impl UnwindSafe for Move",1,["pabi::chess::core::Move"]],["impl UnwindSafe for Piece",1,["pabi::chess::core::Piece"]],["impl UnwindSafe for RankIter",1,["pabi::chess::core::RankIter"]],["impl UnwindSafe for SquareIter",1,["pabi::chess::core::SquareIter"]],["impl UnwindSafe for Position",1,["pabi::chess::position::Position"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/trait.impl/strum/trait.IntoEnumIterator.js b/docs/trait.impl/strum/trait.IntoEnumIterator.js new file mode 100644 index 00000000..2671bcb2 --- /dev/null +++ b/docs/trait.impl/strum/trait.IntoEnumIterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"pabi":[["impl IntoEnumIterator for Direction"],["impl IntoEnumIterator for File"],["impl IntoEnumIterator for Rank"],["impl IntoEnumIterator for Square"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/docs/type.impl/arrayvec/arrayvec/struct.ArrayVec.js b/docs/type.impl/arrayvec/arrayvec/struct.ArrayVec.js new file mode 100644 index 00000000..bae494a7 --- /dev/null +++ b/docs/type.impl/arrayvec/arrayvec/struct.ArrayVec.js @@ -0,0 +1,3 @@ +(function() {var type_impls = { +"pabi":[["
source§

impl<T, const CAP: usize> ArrayVec<T, CAP>

source

pub fn new() -> ArrayVec<T, CAP>

Create a new empty ArrayVec.

\n

The maximum capacity is given by the generic parameter CAP.

\n\n
use arrayvec::ArrayVec;\n\nlet mut array = ArrayVec::<_, 16>::new();\narray.push(1);\narray.push(2);\nassert_eq!(&array[..], &[1, 2]);\nassert_eq!(array.capacity(), 16);
\n
source

pub const fn new_const() -> ArrayVec<T, CAP>

Create a new empty ArrayVec (const fn).

\n

The maximum capacity is given by the generic parameter CAP.

\n\n
use arrayvec::ArrayVec;\n\nstatic ARRAY: ArrayVec<u8, 1024> = ArrayVec::new_const();
\n
source

pub const fn len(&self) -> usize

Return the number of elements in the ArrayVec.

\n\n
use arrayvec::ArrayVec;\n\nlet mut array = ArrayVec::from([1, 2, 3]);\narray.pop();\nassert_eq!(array.len(), 2);
\n
source

pub const fn is_empty(&self) -> bool

Returns whether the ArrayVec is empty.

\n\n
use arrayvec::ArrayVec;\n\nlet mut array = ArrayVec::from([1]);\narray.pop();\nassert_eq!(array.is_empty(), true);
\n
source

pub const fn capacity(&self) -> usize

Return the capacity of the ArrayVec.

\n\n
use arrayvec::ArrayVec;\n\nlet array = ArrayVec::from([1, 2, 3]);\nassert_eq!(array.capacity(), 3);
\n
source

pub const fn is_full(&self) -> bool

Return true if the ArrayVec is completely filled to its capacity, false otherwise.

\n\n
use arrayvec::ArrayVec;\n\nlet mut array = ArrayVec::<_, 1>::new();\nassert!(!array.is_full());\narray.push(1);\nassert!(array.is_full());
\n
source

pub const fn remaining_capacity(&self) -> usize

Returns the capacity left in the ArrayVec.

\n\n
use arrayvec::ArrayVec;\n\nlet mut array = ArrayVec::from([1, 2, 3]);\narray.pop();\nassert_eq!(array.remaining_capacity(), 1);
\n
source

pub fn push(&mut self, element: T)

Push element to the end of the vector.

\n

Panics if the vector is already full.

\n\n
use arrayvec::ArrayVec;\n\nlet mut array = ArrayVec::<_, 2>::new();\n\narray.push(1);\narray.push(2);\n\nassert_eq!(&array[..], &[1, 2]);
\n
source

pub fn try_push(&mut self, element: T) -> Result<(), CapacityError<T>>

Push element to the end of the vector.

\n

Return Ok if the push succeeds, or return an error if the vector\nis already full.

\n\n
use arrayvec::ArrayVec;\n\nlet mut array = ArrayVec::<_, 2>::new();\n\nlet push1 = array.try_push(1);\nlet push2 = array.try_push(2);\n\nassert!(push1.is_ok());\nassert!(push2.is_ok());\n\nassert_eq!(&array[..], &[1, 2]);\n\nlet overflow = array.try_push(3);\n\nassert!(overflow.is_err());
\n
source

pub unsafe fn push_unchecked(&mut self, element: T)

Push element to the end of the vector without checking the capacity.

\n

It is up to the caller to ensure the capacity of the vector is\nsufficiently large.

\n

This method uses debug assertions to check that the arrayvec is not full.

\n\n
use arrayvec::ArrayVec;\n\nlet mut array = ArrayVec::<_, 2>::new();\n\nif array.len() + 2 <= array.capacity() {\n    unsafe {\n        array.push_unchecked(1);\n        array.push_unchecked(2);\n    }\n}\n\nassert_eq!(&array[..], &[1, 2]);
\n
source

pub fn truncate(&mut self, new_len: usize)

Shortens the vector, keeping the first len elements and dropping\nthe rest.

\n

If len is greater than the vector’s current length this has no\neffect.

\n\n
use arrayvec::ArrayVec;\n\nlet mut array = ArrayVec::from([1, 2, 3, 4, 5]);\narray.truncate(3);\nassert_eq!(&array[..], &[1, 2, 3]);\narray.truncate(4);\nassert_eq!(&array[..], &[1, 2, 3]);
\n
source

pub fn clear(&mut self)

Remove all elements in the vector.

\n
source

pub fn insert(&mut self, index: usize, element: T)

Insert element at position index.

\n

Shift up all elements after index.

\n

It is an error if the index is greater than the length or if the\narrayvec is full.

\n

Panics if the array is full or the index is out of bounds. See\ntry_insert for fallible version.

\n\n
use arrayvec::ArrayVec;\n\nlet mut array = ArrayVec::<_, 2>::new();\n\narray.insert(0, \"x\");\narray.insert(0, \"y\");\nassert_eq!(&array[..], &[\"y\", \"x\"]);\n
\n
source

pub fn try_insert(\n &mut self,\n index: usize,\n element: T\n) -> Result<(), CapacityError<T>>

Insert element at position index.

\n

Shift up all elements after index; the index must be less than\nor equal to the length.

\n

Returns an error if vector is already at full capacity.

\n

Panics index is out of bounds.

\n\n
use arrayvec::ArrayVec;\n\nlet mut array = ArrayVec::<_, 2>::new();\n\nassert!(array.try_insert(0, \"x\").is_ok());\nassert!(array.try_insert(0, \"y\").is_ok());\nassert!(array.try_insert(0, \"z\").is_err());\nassert_eq!(&array[..], &[\"y\", \"x\"]);\n
\n
source

pub fn pop(&mut self) -> Option<T>

Remove the last element in the vector and return it.

\n

Return Some( element ) if the vector is non-empty, else None.

\n\n
use arrayvec::ArrayVec;\n\nlet mut array = ArrayVec::<_, 2>::new();\n\narray.push(1);\n\nassert_eq!(array.pop(), Some(1));\nassert_eq!(array.pop(), None);
\n
source

pub fn swap_remove(&mut self, index: usize) -> T

Remove the element at index and swap the last element into its place.

\n

This operation is O(1).

\n

Return the element if the index is in bounds, else panic.

\n

Panics if the index is out of bounds.

\n\n
use arrayvec::ArrayVec;\n\nlet mut array = ArrayVec::from([1, 2, 3]);\n\nassert_eq!(array.swap_remove(0), 1);\nassert_eq!(&array[..], &[3, 2]);\n\nassert_eq!(array.swap_remove(1), 2);\nassert_eq!(&array[..], &[3]);
\n
source

pub fn swap_pop(&mut self, index: usize) -> Option<T>

Remove the element at index and swap the last element into its place.

\n

This is a checked version of .swap_remove.
\nThis operation is O(1).

\n

Return Some( element ) if the index is in bounds, else None.

\n\n
use arrayvec::ArrayVec;\n\nlet mut array = ArrayVec::from([1, 2, 3]);\n\nassert_eq!(array.swap_pop(0), Some(1));\nassert_eq!(&array[..], &[3, 2]);\n\nassert_eq!(array.swap_pop(10), None);
\n
source

pub fn remove(&mut self, index: usize) -> T

Remove the element at index and shift down the following elements.

\n

The index must be strictly less than the length of the vector.

\n

Panics if the index is out of bounds.

\n\n
use arrayvec::ArrayVec;\n\nlet mut array = ArrayVec::from([1, 2, 3]);\n\nlet removed_elt = array.remove(0);\nassert_eq!(removed_elt, 1);\nassert_eq!(&array[..], &[2, 3]);
\n
source

pub fn pop_at(&mut self, index: usize) -> Option<T>

Remove the element at index and shift down the following elements.

\n

This is a checked version of .remove(index). Returns None if there\nis no element at index. Otherwise, return the element inside Some.

\n\n
use arrayvec::ArrayVec;\n\nlet mut array = ArrayVec::from([1, 2, 3]);\n\nassert!(array.pop_at(0).is_some());\nassert_eq!(&array[..], &[2, 3]);\n\nassert!(array.pop_at(2).is_none());\nassert!(array.pop_at(10).is_none());
\n
source

pub fn retain<F>(&mut self, f: F)
where\n F: FnMut(&mut T) -> bool,

Retains only the elements specified by the predicate.

\n

In other words, remove all elements e such that f(&mut e) returns false.\nThis method operates in place and preserves the order of the retained\nelements.

\n\n
use arrayvec::ArrayVec;\n\nlet mut array = ArrayVec::from([1, 2, 3, 4]);\narray.retain(|x| *x & 1 != 0 );\nassert_eq!(&array[..], &[1, 3]);
\n
source

pub unsafe fn set_len(&mut self, length: usize)

Set the vector’s length without dropping or moving out elements

\n

This method is unsafe because it changes the notion of the\nnumber of “valid” elements in the vector. Use with care.

\n

This method uses debug assertions to check that length is\nnot greater than the capacity.

\n
source

pub fn try_extend_from_slice(\n &mut self,\n other: &[T]\n) -> Result<(), CapacityError>
where\n T: Copy,

Copy all elements from the slice and append to the ArrayVec.

\n\n
use arrayvec::ArrayVec;\n\nlet mut vec: ArrayVec<usize, 10> = ArrayVec::new();\nvec.push(1);\nvec.try_extend_from_slice(&[2, 3]).unwrap();\nassert_eq!(&vec[..], &[1, 2, 3]);
\n
§Errors
\n

This method will return an error if the capacity left (see\nremaining_capacity) is smaller then the length of the provided\nslice.

\n
source

pub fn drain<R>(&mut self, range: R) -> Drain<'_, T, CAP>
where\n R: RangeBounds<usize>,

Create a draining iterator that removes the specified range in the vector\nand yields the removed items from start to end. The element range is\nremoved even if the iterator is not consumed until the end.

\n

Note: It is unspecified how many elements are removed from the vector,\nif the Drain value is leaked.

\n

Panics if the starting point is greater than the end point or if\nthe end point is greater than the length of the vector.

\n\n
use arrayvec::ArrayVec;\n\nlet mut v1 = ArrayVec::from([1, 2, 3]);\nlet v2: ArrayVec<_, 3> = v1.drain(0..2).collect();\nassert_eq!(&v1[..], &[3]);\nassert_eq!(&v2[..], &[1, 2]);
\n
source

pub fn into_inner(self) -> Result<[T; CAP], ArrayVec<T, CAP>>

Return the inner fixed size array, if it is full to its capacity.

\n

Return an Ok value with the array if length equals capacity,\nreturn an Err with self otherwise.

\n
source

pub unsafe fn into_inner_unchecked(self) -> [T; CAP]

Return the inner fixed size array.

\n

Safety:\nThis operation is safe if and only if length equals capacity.

\n
source

pub fn take(&mut self) -> ArrayVec<T, CAP>

Returns the ArrayVec, replacing the original with a new empty ArrayVec.

\n\n
use arrayvec::ArrayVec;\n\nlet mut v = ArrayVec::from([0, 1, 2, 3]);\nassert_eq!([0, 1, 2, 3], v.take().into_inner().unwrap());\nassert!(v.is_empty());
\n
source

pub fn as_slice(&self) -> &[T]

Return a slice containing all elements of the vector.

\n
source

pub fn as_mut_slice(&mut self) -> &mut [T]

Return a mutable slice containing all elements of the vector.

\n
source

pub fn as_ptr(&self) -> *const T

Return a raw pointer to the vector’s buffer.

\n
source

pub fn as_mut_ptr(&mut self) -> *mut T

Return a raw mutable pointer to the vector’s buffer.

\n
",0,"pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> AsMut<[T]> for ArrayVec<T, CAP>

source§

fn as_mut(&mut self) -> &mut [T]

Converts this type into a mutable reference of the (usually inferred) input type.
","AsMut<[T]>","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> AsRef<[T]> for ArrayVec<T, CAP>

source§

fn as_ref(&self) -> &[T]

Converts this type into a shared reference of the (usually inferred) input type.
","AsRef<[T]>","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> Borrow<[T]> for ArrayVec<T, CAP>

source§

fn borrow(&self) -> &[T]

Immutably borrows from an owned value. Read more
","Borrow<[T]>","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> BorrowMut<[T]> for ArrayVec<T, CAP>

source§

fn borrow_mut(&mut self) -> &mut [T]

Mutably borrows from an owned value. Read more
","BorrowMut<[T]>","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> Clone for ArrayVec<T, CAP>
where\n T: Clone,

source§

fn clone(&self) -> ArrayVec<T, CAP>

Returns a copy of the value. Read more
source§

fn clone_from(&mut self, rhs: &ArrayVec<T, CAP>)

Performs copy-assignment from source. Read more
","Clone","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> Debug for ArrayVec<T, CAP>
where\n T: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
","Debug","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> Default for ArrayVec<T, CAP>

source§

fn default() -> ArrayVec<T, CAP>

Return an empty array

\n
","Default","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> Deref for ArrayVec<T, CAP>

§

type Target = [T]

The resulting type after dereferencing.
source§

fn deref(&self) -> &<ArrayVec<T, CAP> as Deref>::Target

Dereferences the value.
","Deref","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> DerefMut for ArrayVec<T, CAP>

source§

fn deref_mut(&mut self) -> &mut <ArrayVec<T, CAP> as Deref>::Target

Mutably dereferences the value.
","DerefMut","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> Drop for ArrayVec<T, CAP>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
","Drop","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> Extend<T> for ArrayVec<T, CAP>

Extend the ArrayVec with an iterator.

\n

Panics if extending the vector exceeds its capacity.

\n
source§

fn extend<I>(&mut self, iter: I)
where\n I: IntoIterator<Item = T>,

Extend the ArrayVec with an iterator.

\n

Panics if extending the vector exceeds its capacity.

\n
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
","Extend","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> From<[T; CAP]> for ArrayVec<T, CAP>

Create an ArrayVec from an array.

\n\n
use arrayvec::ArrayVec;\n\nlet mut array = ArrayVec::from([1, 2, 3]);\nassert_eq!(array.len(), 3);\nassert_eq!(array.capacity(), 3);
\n
source§

fn from(array: [T; CAP]) -> ArrayVec<T, CAP>

Converts to this type from the input type.
","From<[T; CAP]>","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> FromIterator<T> for ArrayVec<T, CAP>

Create an ArrayVec from an iterator.

\n

Panics if the number of elements in the iterator exceeds the arrayvec’s capacity.

\n
source§

fn from_iter<I>(iter: I) -> ArrayVec<T, CAP>
where\n I: IntoIterator<Item = T>,

Create an ArrayVec from an iterator.

\n

Panics if the number of elements in the iterator exceeds the arrayvec’s capacity.

\n
","FromIterator","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> Hash for ArrayVec<T, CAP>
where\n T: Hash,

source§

fn hash<H>(&self, state: &mut H)
where\n H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where\n H: Hasher,\n Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
","Hash","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> IntoIterator for ArrayVec<T, CAP>

Iterate the ArrayVec with each element by value.

\n

The vector is consumed by this operation.

\n\n
use arrayvec::ArrayVec;\n\nfor elt in ArrayVec::from([1, 2, 3]) {\n    // ...\n}
\n
§

type Item = T

The type of the elements being iterated over.
§

type IntoIter = IntoIter<T, CAP>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> IntoIter<T, CAP>

Creates an iterator from a value. Read more
","IntoIterator","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> Ord for ArrayVec<T, CAP>
where\n T: Ord,

source§

fn cmp(&self, other: &ArrayVec<T, CAP>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where\n Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where\n Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where\n Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
","Ord","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> PartialEq<[T]> for ArrayVec<T, CAP>
where\n T: PartialEq,

source§

fn eq(&self, other: &[T]) -> bool

This method tests for self and other values to be equal, and is used\nby ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always\nsufficient, and should not be overridden without very good reason.
","PartialEq<[T]>","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> PartialEq for ArrayVec<T, CAP>
where\n T: PartialEq,

source§

fn eq(&self, other: &ArrayVec<T, CAP>) -> bool

This method tests for self and other values to be equal, and is used\nby ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always\nsufficient, and should not be overridden without very good reason.
","PartialEq","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> PartialOrd for ArrayVec<T, CAP>
where\n T: PartialOrd,

source§

fn partial_cmp(&self, other: &ArrayVec<T, CAP>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
source§

fn lt(&self, other: &ArrayVec<T, CAP>) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
source§

fn le(&self, other: &ArrayVec<T, CAP>) -> bool

This method tests less than or equal to (for self and other) and is used by the <=\noperator. Read more
source§

fn ge(&self, other: &ArrayVec<T, CAP>) -> bool

This method tests greater than or equal to (for self and other) and is used by the >=\noperator. Read more
source§

fn gt(&self, other: &ArrayVec<T, CAP>) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
","PartialOrd","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> TryFrom<&[T]> for ArrayVec<T, CAP>
where\n T: Clone,

Try to create an ArrayVec from a slice. This will return an error if the slice was too big to\nfit.

\n\n
use arrayvec::ArrayVec;\nuse std::convert::TryInto as _;\n\nlet array: ArrayVec<_, 4> = (&[1, 2, 3] as &[_]).try_into().unwrap();\nassert_eq!(array.len(), 3);\nassert_eq!(array.capacity(), 4);
\n
§

type Error = CapacityError

The type returned in the event of a conversion error.
source§

fn try_from(\n slice: &[T]\n) -> Result<ArrayVec<T, CAP>, <ArrayVec<T, CAP> as TryFrom<&[T]>>::Error>

Performs the conversion.
","TryFrom<&[T]>","pabi::chess::core::MoveList"],["
source§

impl<T, const CAP: usize> Eq for ArrayVec<T, CAP>
where\n T: Eq,

","Eq","pabi::chess::core::MoveList"]] +};if (window.register_type_impls) {window.register_type_impls(type_impls);} else {window.pending_type_impls = type_impls;}})() \ No newline at end of file