Code Monkey home page Code Monkey logo

burntnail-utils's Introduction

BurntNail Utils

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.

Error Extensions

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

Time Based Structs

Scoped Timer

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.

Do On Interval

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.

Memory Cacher

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.

Coordinates

A struct for coordinates, with generic interior types and maximum widths/heights.

Either

A basic Either enum type with Left, Right and some conversion methods.

Piston Cacher

A struct for caching piston2d images based on file paths.

Multidimensional Arrays

Currently only contains a 2D array, which can be indexed using either the native coordinates or (usize, usize)

TODO

  • Change ThreadSafeScopedToListTimer to use different things which can be pushed to (maybe new trait?)
  • Rename some things to make it more clear
  • Docu-Tests and more examples

burntnail-utils's People

Contributors

burntnail avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.