Expand description
§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§
- Functions for checking if two floating-point numbers are close enough to be considered equal
- Filesystem manipulation operations.
- Composable external iteration.
- Overloadable operators.
- Functions for fully ordering
PartialOrd
types - My custom smart threads. Also reexports
std::thread::*
for convenience.
Macros§
- Conditionally construct
Vec
s - Declares transparent external child modules
- Maps an enum to an option for use with
Iterator::filter_map
Structs§
- Wraps a reference to a
String
representation of some type - A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically Reference Counted’.
- A
Duration
type to represent a span of time, typically used for system timeouts. - An object providing access to an open file on the filesystem.
- Configuration for formatting.
- A hash map implemented with quadratic probing and SIMD lookup.
- An iterator that moves out of a vector.
- A mutual exclusion primitive useful for protecting shared data
- A slice of a path (akin to
str
). - An owned, mutable path (akin to
String
). - A single-threaded reference-counting pointer. ‘Rc’ stands for ‘Reference Counted’.
- Wrapper that allows consuming transformations on borrowed data
Enums§
- An iterator adaptor created by
KaiIterator::chain_if
- An iterator adaptor created by
KaiIterator::chain_if_else
- An
Ordering
is the result of a comparison between two values.
Constants§
- Archimedes’ constant (π)
- Archimedes’ constant (π)
Traits§
- Allows the binding and mutation of a value in a single line
- Maps
bool
s toOption
s in one line - A
BufRead
is a type ofRead
er which has an internal buffer, allowing it to perform extra ways of reading. ?
formatting.- Used for immutable dereferencing operations, like
*v
. - Used for mutable dereferencing operations, like in
*v = 1;
. - Format trait for an empty format,
{}
. Error
is a trait representing the basic expectations for error values, i.e., values of typeE
inResult<T, E>
.- Parse a value from a string
- Used for indexing operations (
container[index]
) in immutable contexts. - Used for indexing operations (
container[index]
) in mutable contexts. - Generates my custom iterator adapters
- The
Read
trait allows for reading bytes from a source. - A trait for objects which are byte-oriented sinks.
Functions§
- Temporarily gain access to an immutable reference as mutable
- Constructs a new handle to the standard input of the current process.
Type Aliases§
- An dynamic
Result
type - An alias for
fmt::Result
- An alias for
io::Result
Derive Macros§
- Derive macro generating an impl of the trait
Debug
.