Expand description
§Timecat Chess Engine
Timecat is a UCI-compatible chess engine designed in Rust that combines powerful algorithms and advanced evaluation techniques to deliver top-notch chess analysis and game play. Using alpha-beta pruning with the negamax algorithm and the NNUE evaluation method, Timecat achieves enhanced depth and accuracy in game analysis.
§Timecat as a Library
Timecat was originally conceived as a personal project. However, with the onset of a new chess-related project, I realized the benefits of publishing Timecat as a library to avoid excessive code duplication. Initially designed for personal use, Timecat will now be refined and updated to enhance its functionality and usability as a library, making it more accessible and beneficial for other users. Also the documentation will be further improved.
Make sure to always update rust to the latest version to use this library.
§⚠️ Beta Version Notice
This chess engine is currently in beta and actively under development. Please be aware that breaking changes may occur as new features are added and improvements are made. Your feedback and contributions are greatly appreciated as I continue to refine and enhance the engine.
§Key Features
- UCI Compatibility: Fully compatible with the Universal Chess Interface (UCI) standard.
- Advanced Algorithms: Utilizes alpha-beta pruning and the negamax algorithm for efficient move searching.
- NNUE Evaluation: Incorporates NNUE (efficiently updatable neural network) for state-of-the-art position evaluation.
- Customizable Builds: Supports tailored builds through configurable cargo features.
§Integration of the Chess Library
Initially, Timecat was dependent on the external chess
library, which is available at https://github.com/jordanbray/chess. To align more closely with specific requirements, the library was integrated directly into Timecat. This integration permitted significant modifications and extensions to its functionalities, thereby enhancing the engine’s overall capabilities. Such integration demonstrates a commitment to adapting and evolving the tools to secure the best possible performance and accuracy in chess analytics.
§User Controls
In the library, only pub
or non-pub
visibility modifiers are used (unless extremely necessary to prevent users from making catastrophic errors). This approach ensures that all potentially useful functions and structures are accessible to the user, avoiding the situation where a pub(crate)
might restrict access to valuable components—a problem I’ve encountered while using the chess
library. Therefore, only the features that is considered essential are included in timecat::prelude
; all other functionalities are available for direct import from the timecat
library.
Also several cargo features have been introduced to provide users with complete control over the code’s behavior.
§NNUE Support
Timecat currently utilizes the Stockfish NNUE for evaluation (only HalfKP
supported). Plans are in place to transition to a custom-trained NNUE in the future.
§Engine Strength
Although it hasn’t been thoroughly tested yet, but my chess engine is capable of defeating chess.com’s max bot, which has an Elo rating of 3200.
§Installation
§Installing as a Binary
Optimize your setup for the best performance:
RUSTFLAGS="-C target-cpu=native" cargo install timecat
§Compilation from Source
Clone the repository and compile with native optimizations:
git clone https://github.com/Gourab-Ghosh/timecat-rs.git
cd timecat-rs
RUSTFLAGS="-C target-cpu=native" cargo run --release
§Compilation with Docker
Clone the repository and compile with native optimizations:
git clone https://github.com/Gourab-Ghosh/timecat-rs.git
cd timecat-rs
sudo docker build -t timecat .
sudo docker run -it --rm timecat
§Usage as a Library
§Minimal Dependency Integration
Integrate Timecat into your Rust projects with minimal dependencies:
cargo add timecat --no-default-features
§Examples
This example demonstrates how to set up a chess board, make moves, evaluate board positions, and utilize the inbuilt engine to find optimal moves using the timecat
library. Some optional features needs to be enabled.
First, add the timecat crate to your project with the necessary features enabled:
cargo add timecat --no-default-features --features "inbuilt_nnue extras"
Then, you can proceed with the following Rust code:
use timecat::prelude::*;
fn main() {
// Initialize a chess board with the default starting position.
let mut board = Board::default();
// Apply moves in standard algebraic notation.
board.push_san("e4").expect("Failed to make move: e4");
board.push_san("e5").expect("Failed to make move: e5");
// Evaluate the current board position using the inbuilt_nnue feature.
let evaluation = board.evaluate();
println!("Current Evaluation: {}\n", evaluation);
// Initialize the engine with the current board state.
let mut engine = Engine::from_board(board);
// Configure the engine to search for the best move up to a depth of 10 plies.
let response = engine.search_depth_verbose(10);
let best_move = response.get_best_move().expect("No best move found");
// Output the best move found by the engine.
println!(
"\nBest Move: {}",
best_move
.san(engine.get_board())
.expect("Failed to generate SAN")
);
}
You can use UCI commands, although it’s not recommended in production environments due to potential parsing delays. The inbuilt_nnue
optional feature is also required in this context.
As previous, add the timecat crate to your project:
cargo add timecat --no-default-features --features inbuilt_nnue
Then, you can proceed with the following Rust code:
use timecat::prelude::*;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
// Create the default engine initialized with the standard starting position.
let mut runner = timecat::TimecatBuilder::<Engine>::default().build();
// List of UCI commands to be executed on the chess engine.
let uci_commands = [
// Checks if the engine is ready to receive commands.
"isready",
// Sets the move overhead option.
"setoption name move overhead value 200",
// Display the current state of the chess board.
"d",
// Sets a new game position by applying the moves.
"position startpos moves e2e4 e7e5",
// Instructs the engine to calculate the best move within 3000 milliseconds.
"go movetime 3000",
];
// Process each UCI command and handle potential errors.
for command in uci_commands {
runner.run_uci_command(command)?;
}
Ok(())
}
Or just enjoy the engine play against itself:
use timecat::prelude::*;
use std::time::Duration;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
self_play(
&mut Engine::default(),
// Take 10 milliseconds per move
&GoCommand::from_millis(10).into(),
// set to verbose mode (true/false)
true,
// Limit to number of moves to play (u16/Some(u16)/None), None denoting no limit
100,
)?;
Ok(())
}
The selfplay
command works on the binary as well.
§Cargo Features
binread
: Binread support.nnue_reader
: Adds support for NNUE evaluation by reading nnue files.inbuilt_nnue
: Integrate built-in NNUE evaluation support by including the nnue file directly into the binary, fetched using the minreq library.extras
: Adds some functionalities not needed in binary, to get better insights of the behavior of the code. These feature is disabled by default because they requires some computations which are not needed in the binary.colored
: Displays all information in a visually appealing colored format for enhanced readability.serde
: Enables serialization and deserialization support viaserde
.wasm
: Webassembly support (Still in Testing phase).pyo3
: Python support (Still in Testing phase).debug
: Intended solely for development use.experimental
: Codes under development for upcoming features.
Default features include inbuilt_nnue
and colored
.
§TODO
- Implement other variants of chess.
- Implement Syzygy Tablebase.
- Organize the Polyglot Table codes to make it usable.
- Organize the pgn related codes to make it usable.
- Implement xboard feature.
-
Add svg feature like the python library
chess
for better visualization.
§License
Timecat is open-sourced under the GNU GENERAL PUBLIC LICENSE. You are free to use, modify, and distribute it under the same license.
§Contributing
Feel free to fork the repository, make improvements, and submit pull requests. You can also report issues or suggest features through the GitHub issue tracker.
§Support the developer
If you like Timecat, please consider a little donation.
Re-exports§
pub use search_controller::SearchController;
pub use selfplay::self_play;
pub use tests::test;
pub use board::*;
pub use chess::*;
pub use constants::atomic::*;
pub use constants::binary::*;
pub use constants::bitboard_and_square::*;
pub use constants::board::*;
pub use constants::cache_table::*;
pub use constants::color::*;
pub use constants::default_parameters::*;
pub use constants::description::*;
pub use constants::engine::*;
pub use constants::evaluate::*;
pub use constants::fen::*;
pub use constants::files::*;
pub use constants::io::*;
pub use constants::piece::*;
pub use constants::ranks::*;
pub use constants::strings::*;
pub use constants::types::*;
pub use custom_engine::*;
pub use error::*;
pub use evaluate::*;
pub use nnue::*;
pub use parse::*;
pub use polyglot::*;
pub use runner::*;
pub use search::*;
pub use sort::*;
pub use tt::*;
pub use uci::*;
pub use utils::*;
Modules§
- __
std_ iter - Composable external iteration.
- board
- This module defines the
Board
structure and its associated methods for managing the game board in the this library. It handles tasks such as initializing the board, displaying the board state, etc. - chess
- constants
- custom_
engine - env
- Inspection and manipulation of the process’s environment.
- error
- evaluate
- fmt
- Utilities for formatting and printing
String
s. - fs
- Filesystem manipulation operations.
- nnue
- parse
- polyglot
- prelude
- runner
- search
- search_
controller - selfplay
- sort
- structs
- The concrete iterator types.
- syzygy
- tests
- thread
- Native threads.
- traits
- Traits helpful for using certain
Itertools
methods in generic contexts. - tt
- uci
- useful_
macros - utils
Macros§
- chain
- Chain zero or more iterators together into one sequence.
- env
- Inspects an environment variable at compile time.
- get_
item_ unchecked - get_
item_ unchecked_ mut - interpolate_
float - inverse_
interpolate_ float - iproduct
- Create an iterator over the “cartesian product” of iterators.
- izip
- Create an iterator running multiple iterators in lockstep.
- match_
interpolate_ float - paste
- print_
wasm - println_
wasm - wrap_
pyfunction - Wraps a Rust function annotated with
#[pyfunction]
. - wrap_
pyfunction_ bound Deprecated - Wraps a Rust function annotated with
#[pyfunction]
.
Structs§
- Arc
- A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically Reference Counted’.
- Array
Vec - A vector with a fixed capacity.
- Atomic
Bool - A boolean type which can be safely shared between threads.
- Atomic
Usize - An integer type which can be safely shared between threads.
- Batching
- 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.
- Borrowed
- A borrowed equivalent to
Bound
. - Bound
- A GIL-attached equivalent to
Py<T>
. - BufReader
- The
BufReader<R>
struct adds buffering to any reader. - Chunk
- An iterator for the elements in a single chunk.
- ChunkBy
ChunkBy
is the storage for the lazy grouping operation.- Chunks
- An iterator that yields the Chunk iterators.
- Circular
Tuple Windows - 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.
- Combinations
With Replacement - An iterator to iterate through all the
n
-length combinations in an iterator, with replacement. - Duration
- A
Duration
type to represent a span of time, typically used for system timeouts. - Exactly
OneError - Iterator returned for the error case of
Itertools::exactly_one()
This iterator yields exactly the same elements as the input iterator. - Filter
MapOk - An iterator adapter to filter and apply a transformation on values within a nested
Result::Ok
. - Filter
Ok - An iterator adapter to filter values within a nested
Result::Ok
. - Flatten
Ok - An iterator adaptor that flattens
Result::Ok
values and allowsResult::Err
values through unchanged. - Format
- Format all iterator elements lazily, separated by
sep
. - Format
With - Format all iterator elements lazily, separated by
sep
. - Group
- An iterator for the elements in a single group.
- Grouping
Map GroupingMap
is an intermediate struct for efficient group-and-fold operations. It groups elements by their key and at the same time fold each group using some aggregating operation.- Groups
- An iterator that yields the Group iterators.
- HashSet
- A hash set implemented as a
HashMap
where the value is()
. - Instant
- A measurement of a monotonically nondecreasing clock.
Opaque and useful only with
Duration
. - Interleave
- An iterator adaptor that alternates elements from two iterators until both run out.
- Interleave
Shortest - An iterator adaptor that alternates elements from the two iterators until one of them runs out.
- Intersperse
With - An iterator adaptor to insert a particular value created by a function between each element of the adapted iterator.
- Into
Chunks ChunkLazy
is the storage for a lazy chunking operation.- Iterate
- An iterator that infinitely applies function to value and yields results.
- KMerge
By - An iterator adaptor that merges an abitrary number of base iterators according to an ordering function.
- Lazy
Lock - A value which is initialized on the first access.
- MergeBy
- An iterator adaptor that merges the two base iterators in ascending order. If both base iterators are sorted (ascending), the result is sorted.
- Multi
Peek - See
multipeek()
for more information. - Multi
Product - An iterator adaptor that iterates over the cartesian product of
multiple iterators of type
I
. - PadUsing
- An iterator adaptor that pads a sequence to a minimum length by filling missing elements using a closure.
- Parse
Bool Error - An error returned when parsing a
bool
usingfrom_str
fails - Parse
IntError - An error which can be returned when parsing an integer.
- Path
- A slice of a path (akin to
str
). - PathBuf
- An owned, mutable path (akin to
String
). - PeekNth
- See
peek_nth()
for more information. - Peeking
Take While - An iterator adaptor that takes items while a closure returns
true
. - Permutations
- An iterator adaptor that iterates through all the
k
-permutations of the elements from an iterator. - Positions
- An iterator adapter to get the positions of each element that matches a predicate.
- Powerset
- An iterator to iterate through the powerset of the elements from an iterator.
- Process
Results - An iterator that produces only the
T
values as long as the inner iterator producesOk(T)
. - Product
- An iterator adaptor that iterates over the cartesian product of
the element sets of two iterators
I
andJ
. - PutBack
- An iterator adaptor that allows putting back a single item to the front of the iterator.
- PutBackN
- An iterator adaptor that allows putting multiple items in front of the iterator.
- Py
- A GIL-independent reference to an object allocated on the Python heap.
- PyAny
- Represents any Python object.
- PyClass
Initializer - Initializer for our
#[pyclass]
system. - PyErr
- Represents a Python exception.
- PyModule
- Represents a Python
module
object. - PyRef
- A wrapper type for an immutably borrowed value from a [
Bound<'py, T>
]. - PyRef
Mut - A wrapper type for a mutably borrowed value from a [
Bound<'py, T>
]. - Python
- A marker token that represents holding the GIL.
- Range
- A (half-open) range bounded inclusively below and exclusively above
(
start..end
). - RcIter
- A wrapper for
Rc<RefCell<I>>
, that implements theIterator
trait. - RepeatN
- An iterator that produces n repetitions of an element.
- Reverse
- A helper struct for reverse ordering.
- RwLock
- A reader-writer lock
- Take
While Inclusive - An iterator adaptor that consumes elements while the given predicate is
true
, including the element for which the predicate first returnedfalse
. - Take
While Ref - An iterator adaptor that borrows from a
Clone
-able iterator to only pick off elements while the predicate returnstrue
. - Tee
- One half of an iterator pair where both return the same elements.
- Tuple
Buffer - An iterator over a incomplete tuple.
- Tuple
Combinations - An iterator to iterate through all combinations in a
Clone
-able iterator that produces tuples of a specific size. - Tuple
Windows - An iterator over all contiguous windows that produces tuples of a specific size.
- Tuples
- An iterator that groups the items in tuples of a specific size.
- Unfold
Deprecated - See
unfold
for more information. - Unique
- An iterator adapter to filter out duplicate elements.
- Unique
By - An iterator adapter to filter out duplicate elements.
- Update
- An iterator adapter to apply a mutating function to each element before yielding it.
- While
Some - An iterator adaptor that filters
Option<A>
iterator elements and producesA
. Stops on the firstNone
encountered. - With
Position - An iterator adaptor that wraps each element in an
Position
. - Wrapping
- Provides intentionally-wrapped arithmetic on
T
. - Zip
- See
multizip
for more information. - ZipEq
- An iterator which iterates two other iterators simultaneously and panic if they have different lengths.
- ZipLongest
- An iterator which iterates two other iterators simultaneously
and wraps the elements in
EitherOrBoth
.
Enums§
- Diff
- A type returned by the
diff_with
function. - Either
- The enum
Either
with variantsLeft
andRight
is a general purpose sum type with two cases. - Either
OrBoth - Value that either holds a single A or B, or both.
- Fold
While - An enum used for controlling the execution of
fold_while
. - MinMax
Result MinMaxResult
is an enum returned byminmax
.- Ordering
- An
Ordering
is the result of a comparison between two values. - Position
- The first component of the value yielded by
WithPosition
. Indicates the position of this element in the iterator results.
Statics§
Traits§
- Add
- The addition operator
+
. - AddAssign
- The addition assignment operator
+=
. - BinRead
- A
BinRead
trait allows reading a structure from anything that implementsio::Read
andio::Seek
BinRead is implemented on the type to be read out of the given reader - BitAnd
- The bitwise AND operator
&
. - BitAnd
Assign - The bitwise AND assignment operator
&=
. - BitOr
- The bitwise OR operator
|
. - BitOr
Assign - The bitwise OR assignment operator
|=
. - BitXor
- The bitwise XOR operator
^
. - BitXor
Assign - The bitwise XOR assignment operator
^=
. - Debug
?
formatting.- Deref
- Used for immutable dereferencing operations, like
*v
. - Deref
Mut - Used for mutable dereferencing operations, like in
*v = 1;
. - Deserialize
- A data structure that can be deserialized from any data format supported by Serde.
- Deserializer
- A data format that can deserialize any data structure supported by Serde.
- Div
- The division operator
/
. - DivAssign
- The division assignment operator
/=
. - Error
Error
is a trait representing the basic expectations for error values, i.e., values of typeE
inResult<T, E>
.- From
- Used to do value-to-value conversions while consuming the input value. It is the reciprocal of
Into
. - From
PyObject - Extract a type from a Python object.
- FromStr
- Parse a value from a string
- Hash
- A hashable type.
- Hasher
- A trait for hashing an arbitrary stream of bytes.
- Index
- Used for indexing operations (
container[index]
) in immutable contexts. - Index
Mut - Used for indexing operations (
container[index]
) in mutable contexts. - IntoPy
Deprecated - Defines a conversion from a Rust type to a Python object.
- Into
PyObject - Defines a conversion from a Rust type to a Python object, which may fail.
- Itertools
- An
Iterator
blanket implementation that provides extra adaptors and methods. - Mul
- The multiplication operator
*
. - MulAssign
- The multiplication assignment operator
*=
. - Multi
Unzip - An iterator that can be unzipped into multiple collections.
- Neg
- The unary negation operator
-
. - Not
- The unary logical negation operator
!
. - Peeking
Next - An iterator that allows peeking at an element before deciding to accept it.
- PyAny
Methods - This trait represents the Python APIs which are usable on all Python objects.
- PyBool
Methods - Implementation of functionality for
PyBool
. - PyByte
Array Methods - Implementation of functionality for
PyByteArray
. - PyBytes
Methods - Implementation of functionality for
PyBytes
. - PyCapsule
Methods - Implementation of functionality for
PyCapsule
. - PyComplex
Methods - Implementation of functionality for
PyComplex
. - PyDict
Methods - Implementation of functionality for
PyDict
. - PyFloat
Methods - Implementation of functionality for
PyFloat
. - PyFrozen
SetMethods - Implementation of functionality for
PyFrozenSet
. - PyList
Methods - Implementation of functionality for
PyList
. - PyMapping
Methods - Implementation of functionality for
PyMapping
. - PyMapping
Proxy Methods - Implementation of functionality for
PyMappingProxy
. - PyModule
Methods - Implementation of functionality for
PyModule
. - PySequence
Methods - Implementation of functionality for
PySequence
. - PySet
Methods - Implementation of functionality for
PySet
. - PySlice
Methods - Implementation of functionality for
PySlice
. - PyString
Methods - Implementation of functionality for
PyString
. - PyTraceback
Methods - Implementation of functionality for
PyTraceback
. - PyTuple
Methods - Implementation of functionality for
PyTuple
. - PyType
Methods - Implementation of functionality for
PyType
. - PyWeakref
Methods - Implementation of functionality for
PyWeakref
. - Read
- The
Read
trait allows for reading bytes from a source. - Rem
- The remainder operator
%
. - RemAssign
- The remainder assignment operator
%=
. - Seek
- The
Seek
trait provides a cursor which can be moved within a stream of bytes. - Serialize
- A data structure that can be serialized into any data format supported by Serde.
- Serializer
- A data format that can serialize any data structure supported by Serde.
- Shl
- The left shift operator
<<
. Note that because this trait is implemented for all integer types with multiple right-hand-side types, Rust’s type checker has special handling for_ << _
, setting the result type for integer operations to the type of the left-hand-side operand. This means that thougha << b
anda.shl(b)
are one and the same from an evaluation standpoint, they are different when it comes to type inference. - ShlAssign
- The left shift assignment operator
<<=
. - Shr
- The right shift operator
>>
. Note that because this trait is implemented for all integer types with multiple right-hand-side types, Rust’s type checker has special handling for_ >> _
, setting the result type for integer operations to the type of the left-hand-side operand. This means that thougha >> b
anda.shr(b)
are one and the same from an evaluation standpoint, they are different when it comes to type inference. - ShrAssign
- The right shift assignment operator
>>=
. - Sub
- The subtraction operator
-
. - SubAssign
- The subtraction assignment operator
-=
. - Sum
- Trait to represent types that can be created by summing up an iterator.
- ToPy
Object Deprecated - Conversion trait that allows various objects to be converted into
PyObject
. - Write
- A trait for objects which are byte-oriented sinks.
Functions§
- all
- Test whether the predicate holds for all elements in the iterable.
- any
- Test whether the predicate holds for any elements in the iterable.
- assert_
equal - Assert that two iterables produce equal sequences, with the same
semantics as
equal(a, b)
. - chain
- Takes two iterables and creates a new iterator over both in sequence.
- cloned
- Create an iterator that clones each element from
&T
toT
. - concat
- Combine all an iterator’s elements into one element by using
Extend
. - cons_
tuples - Create an iterator that maps for example iterators of
((A, B), C)
to(A, B, C)
. - diff_
with - Compares every element yielded by both
i
andj
with the given function in lock-step and returns aDiff
which describes howj
differs fromi
. - enumerate
- Iterate
iterable
with a running index. - equal
- Return
true
if both iterables produce equal sequences (elements pairwise equal and sequences of the same length),false
otherwise. - fold
- Perform a fold operation over the iterable.
- interleave
- Create an iterator that interleaves elements in
i
andj
. - intersperse
- Iterate
iterable
with a particular value inserted between each element. - intersperse_
with - Iterate
iterable
with a particular value created by a function inserted between each element. - iterate
- Creates a new iterator that infinitely applies function to value and yields results.
- join
- Combine all iterator elements into one
String
, separated bysep
. - kmerge
- Create an iterator that merges elements of the contained iterators using the ordering function.
- kmerge_
by - Create an iterator that merges elements of the contained iterators.
- max
- Return the maximum value of the iterable.
- merge
- Create an iterator that merges elements in
i
andj
. - merge_
join_ by - Return an iterator adaptor that merge-joins items from the two base iterators in ascending order.
- min
- Return the minimum value of the iterable.
- multipeek
- An iterator adaptor that allows the user to peek at multiple
.next()
values without advancing the base iterator. - multiunzip
- Converts an iterator of tuples into a tuple of containers.
- multizip
- An iterator that generalizes
.zip()
and allows running multiple iterators in lockstep. - partition
- Partition a sequence using predicate
pred
so that elements that map totrue
are placed before elements which map tofalse
. - peek_
nth - A drop-in replacement for
std::iter::Peekable
which adds apeek_nth
method allowing the user topeek
at a value several iterations forward without advancing the base iterator. - process_
results - “Lift” a function of the values of an iterator so that it can process
an iterator of
Result
values instead. - put_
back - Create an iterator where you can put back a single item
- put_
back_ n - Create an iterator where you can put back multiple values to the front of the iteration.
- rciter
- Return an iterator inside a
Rc<RefCell<_>>
wrapper. - repeat_
n - Create an iterator that produces
n
repetitions ofelement
. - rev
- Iterate
iterable
in reverse. - sorted
- Sort all iterator elements into a new iterator in ascending order.
- sorted_
unstable - Sort all iterator elements into a new iterator in ascending order. This sort is unstable (i.e., may reorder equal elements).
- unfold
Deprecated - Creates a new unfold source with the specified closure as the “iterator function” and an initial state to eventually pass to the closure
- zip
Deprecated - Converts the arguments to iterators and zips them.
- zip_eq
- Zips two iterators but panics if they are not of the same length.
Type Aliases§
- Array
Combinations - Iterator for const generic combinations returned by
.array_combinations()
- BinResult
- A Result for any binread function that can return an error
- Coalesce
- An iterator adaptor that may join together adjacent elements.
- Combinations
- Iterator for
Vec
valued combinations returned by.combinations()
- Cons
Tuples - An iterator that maps an iterator of tuples like
((A, B), C)
to an iterator of(A, B, C)
. - Dedup
- An iterator adaptor that removes repeated duplicates.
- DedupBy
- An iterator adaptor that removes repeated duplicates, determining equality using a comparison function.
- Dedup
ByWith Count - An iterator adaptor that removes repeated duplicates, while keeping a count of how many repeated elements were present. This will determine equality using a comparison function.
- Dedup
With Count - An iterator adaptor that removes repeated duplicates, while keeping a count of how many repeated elements were present.
- Duplicates
- An iterator adapter to filter out duplicate elements.
- Duplicates
By - An iterator adapter to filter for duplicate elements.
- GroupBy
Deprecated - See
ChunkBy
. - Grouping
MapBy GroupingMapBy
is an intermediate struct for efficient group-and-fold operations.- Intersperse
- An iterator adaptor to insert a particular value between each element of the adapted iterator.
- KMerge
- An iterator adaptor that merges an abitrary number of base iterators in ascending order. If all base iterators are sorted (ascending), the result is sorted.
- MapInto
- An iterator adapter to apply
Into
conversion to each element. - MapOk
- An iterator adapter to apply a transformation within a nested
Result::Ok
. - Merge
- An iterator adaptor that merges the two base iterators in ascending order. If both base iterators are sorted (ascending), the result is sorted.
- Merge
Join By - An iterator adaptor that merge-joins items from the two base iterators in ascending order.
- NonZero
U64 - A
u64
that is known not to equal zero. - NonZero
Usize - A
usize
that is known not to equal zero. - PyObject
- A commonly-used alias for
Py<PyAny>
. - PyResult
- Represents the result of a Python call.
Attribute Macros§
- pyclass
- pyfunction
- A proc macro used to expose Rust functions to Python.
- pymethods
- A proc macro used to expose methods to Python.
- pymodule
- A proc macro used to implement Python modules.
Derive Macros§
- BinRead
- Debug
- Derive macro generating an impl of the trait
Debug
. - Deserialize
- From
PyObject - Hash
- Derive macro generating an impl of the trait
Hash
. - Into
PyObject - Into
PyObject Ref - Serialize