Crate sbitty

Source
Expand description

Standard integers does not have any standard implementation of bitwise manipulation. This crate is made to fill this gap and hide ugly bitwise operation which are error prone behind some runtime safe functions.

It is made so you only have to call functions to use it properly. This crate use indexes as you would in vectors or Arrays. If any index error happened in your program you will get Option<T> or Result<_,_> returned to properly handle this in a production ready manner.

Structs§

IndexError
The IndexError struct is used for error handling This should not be seen as an API user

Traits§

GetBit
performing _ & (1 << idx) with n the index and return the boolean corresponding
SetBit
performing _ | (1 << idx) with n the index
ToggleBit
performing _ ^ (1 << idx) with n the index
UnsetBit
performing _ & !(1 << idx) with n the index