Expand description
Random assortment of helpers I didn’t know where to put.
Structs§
- Metric
Formatter - Point
- A 2D point. Uses
CoordType. - Rect
- A 2D rectangle. Uses
CoordType. - Size
- A 2D size. Uses
CoordType.
Constants§
- COORD_
TYPE_ SAFE_ MAX - To avoid overflow issues because you’re adding two
CoordType::MAXvalues together, you can useCOORD_TYPE_SAFE_MAXinstead. - GIBI
- GIGA
- KIBI
- KILO
- MEBI
- MEGA
Traits§
- Ascii
String Helpers - Helpers for ASCII string comparisons.
- Replace
Range Vec::spliceresults in really bad assembly. This doesn’t. Don’t useVec::splice.
Functions§
- file_
read_ uninit Readbut withMaybeUninit<u8>buffers.- minmax
std::cmp::minmaxis unstable, as per usual.- opt_
ptr_ eq - Surprisingly, there’s no way in Rust to do a
ptr::eqonOption<&T>. Usesunsafeso that the debug performance isn’t too bad. - slice_
as_ uninit_ mut - Turns a [
&mut [T]] into a [&mut [MaybeUninit<T>]]. - slice_
as_ uninit_ ref - Turns a [
&[u8]] into a [&[MaybeUninit<T>]]. - slice_
copy_ safe - [
<[T]>::copy_from_slice] panics if the two slices have different lengths. This one just returns the copied amount. - str_
from_ ⚠raw_ parts - Creates a
&strfrom a pointer and a length. Exists, becausestd::str::from_raw_partsis unstable, par for the course.
Type Aliases§
- Coord
Type - A viewport coordinate type used throughout the application.