Crates.io | burntnail-utils |
lib.rs | burntnail-utils |
version | 0.7.1 |
source | src |
created_at | 2022-10-26 22:20:53.999184 |
updated_at | 2022-11-20 21:40:25.259672 |
description | Set of Utilities for Errors, and some cachers/timers/macros |
homepage | |
repository | https://github.com/BurntNail/burntnail-utils/ |
max_upload_size | |
id | 698251 |
size | 71,834 |
Hey! You've found my general utilities for use with rust.
There are quite a few now, and it includes optional tracing
support, with standard println
and eprintln
as fallbacks.
Mainly designed as a utility for use with anyhow
and color-eyre
, so includes ways to turn things like Option
and PosionErr
into Anyhow Errors.
Also includes a trait for quickly logging errors, as an alternative to unwrap
and expect
Includes a ScopedTimer
, where you make a timer, and then on Drop
, it prints out the time it took and a message.
There is also a ThreadSafeScopedToListTimer
, which sends the result to a MemoryCacher
which holds Duration
structs.
A useful struct to hold a timer, and whenever you want to do an action on an interval, you check with it, and it'll say. After, then you either update it manually, or use a guard.
Basically, a circular queue of fixed size. Used to be unsafe using MaybeUninit
, but I then found that it was around 10x faster when I backed it with a normal Vec
.
A struct for coordinates, with generic interior types and maximum widths/heights.
A basic Either enum type with Left, Right and some conversion methods.
A struct for caching piston2d images based on file paths.
Currently only contains a 2D array, which can be indexed using either the native coordinates or (usize, usize)
ThreadSafeScopedToListTimer
to use different things which can be pushed to (maybe new trait?)