[−][src]Crate kai
Description
This library contains my personal Rust prelude and utilities.
Design goals
- Remove the hassle of having to add
use
statements for very common standard library types - Reduce the amount of code that actually has to be written
- Alleviate common Rust pain points
This library is meant to improve your experience writing Rust no matter what you are writing code for. The patterns it tackles are mostly ones that the average Rust programmer encounters on a daily basis.
Utilities
I have made some very simple utilities to aid in writing Rust code:
Modules
thread
Adds custom thread type as well as reexportingstd::thread::*
for convenience.
Functions
order
Functions for fully orderingPartialOrd
typesclose
Functions for checking if two floating-point numbers are close enough to be considered equalpromote_then
Temporarily gain access to an immutable reference as mutable
Traits
BoolMap
Mapsbool
s toOption
s in one lineBind
Allows the binding and mutation of a value in a single lineKaiIterator
Generates my custom iterator adapters
Structs
Adapter
Wraps a reference to a string representation of some typeSwap
Wrapper that allows consuming transformations on borrowed data
Types
Macros
variant!
Maps an enum to an option for use withIterator::filter_map
transparent_mod!
Declares transparent external child modulescond_vec!
Conditionally constructVec
s
Modules
close | Functions for checking if two floating-point numbers are close enough to be considered equal |
fs | Filesystem manipulation operations. |
iter | Composable external iteration. |
ops | Overloadable operators. |
order | Functions for fully ordering |
thread | My custom smart threads. Also reexports |
Macros
cond_vec | Conditionally construct |
transparent_mod | Declares transparent external child modules |
variant | Maps an enum to an option for use with |
Structs
Adapter | Wraps a reference to a |
Arc | A thread-safe reference-counting pointer. 'Arc' stands for 'Atomically Reference Counted'. |
Duration | A |
File | A reference to an open file on the filesystem. |
Formatter | Configuration for formatting. |
HashMap | A hash map implemented with quadratic probing and SIMD lookup. |
HashSet | A hash set implemented as a |
IntoIter | An iterator that moves out of a vector. |
Mutex | A mutual exclusion primitive useful for protecting shared data |
Path | A slice of a path (akin to |
PathBuf | An owned, mutable path (akin to |
Rc | A single-threaded reference-counting pointer. 'Rc' stands for 'Reference Counted'. |
Swap | Wrapper that allows consuming transformations on borrowed data |
Enums
ChainIf | An iterator adaptor created by |
ChainIfElse | An iterator adaptor created by |
Ordering | An |
Constants
PI32 | Archimedes' constant (π) |
PI64 | Archimedes' constant (π) |
Traits
Bind | Allows the binding and mutation of a value in a single line |
BoolMap | Maps |
BufRead | A |
Debug |
|
Deref | Used for immutable dereferencing operations, like |
DerefMut | Used for mutable dereferencing operations, like in |
Display | Format trait for an empty format, |
Error |
|
FromStr | Parse a value from a string |
Index | Used for indexing operations ( |
IndexMut | Used for indexing operations ( |
KaiIterator | Generates my custom iterator adapters |
Read | The |
Write | A trait for objects which are byte-oriented sinks. |
Functions
promote_then⚠ | Temporarily gain access to an immutable reference as mutable |
stdin | Constructs a new handle to the standard input of the current process. |
Type Definitions
DynResult | An dynamic |
FmtResult | An alias for |
IoResult | An alias for |