#jwt #hash #error #jwt-token #password #logging #functions #hsh #date #mini

mini-functions

Highly Performant Utility And Wrapper Functions Library For Rust

7 releases

0.0.7 Jan 7, 2023
0.0.6 Jan 6, 2023
0.0.1 Dec 30, 2022

#196 in Development tools

25 downloads per month

Apache-2.0 OR MIT

91KB
919 lines

Mini Functions đŸĻ€

Made With Love

Highly performant utility and wrapper functions library for Rust 🚀

Mini Functions

Rust Crates.io Lib.rs Docs.rs License

divider

Website â€ĸ Documentation â€ĸ Report Bug â€ĸ Request Feature â€ĸ Contributing Guidelines

Welcome to the Mini Functions Library for Rust 👋

Mini Functions is a highly performant utility and wrapper functions library for Rust that has been carefully designed with optimization and efficiency in mind.

By providing convenient wrapper functions, our library aims to provide a high-level interface for common tasks while still leveraging the performance benefits of Rust under the hood.

These utility functions serve as an essential toolkit for any Rust developer, and the library's design abstractions allow for easy integration into a variety of projects and applications.

Key Features đŸŽ¯

  • Built with Rust — A modern programming language that is well- suited for building high-performance, reliable, and secure systems.
  • High-level Utility Functions — A collection of high-level, abstracted functions for common tasks, such as string manipulation, file manipulation, and data parsing.
  • Wrapper Functions for Easy Access — Wrapper functions that provide a more convenient interface for accessing and using underlying Rust libraries or APIs.
  • Optimization and Performance Tools — Tools for optimizing and improving the performance of Rust code.
  • Multi-platform Support — Support for a variety of platforms, including desktop, mobile, and web.
  • Comprehensive Documentation and Examples — Documentation and examples to help developers understand and use the library effectively.
  • Regular Maintenance and Updates — Regular updates and maintenance to ensure the library stays up-to-date and reliable.

Installation đŸ“Ļ

It takes just a few minutes to get up and running with mini-functions.

Requirements

mini-functions requires Rust 1.57.0 or later.

Documentation

ℹī¸ Info: Please check out our website for more information and find our documentation on docs.rs, lib.rs and crates.io.

Usage 📖

To use mini-functions in your project, add the following to your Cargo.toml file:

[dependencies]
mini-functions = "0.0.7"

Add the following to your main.rs file:

extern crate mini_functions;
use mini_functions::*;

then you can use the functions in your application code.

Examples

Mini Functions comes with a set of examples that you can use to get started. The examples are located in the examples directory of the project. To run the examples, clone the repository and run the following command in your terminal from the project root directory.

cargo run --example date

💡 Note: The examples available are date, hash, log, password, qrcode, random and uuid.

The Functions library 📚

Mini Functions is a library of functions for Rust that provides a collection of tools for working with various aspects of a Rust application. The mini-functions library consists of the following non-exhaustive functions:

1) Date and time functions

The Date and time functions are used to retrieve and manipulate information about dates and times.

Open to view the Date and time functions available in the library

Function Include File Function Prototype Description
Date::date() date.rs fn date() Returns the current date in UTC format.
Date::day() date.rs fn day() Returns the current day.
Date::hour() date.rs fn hour() Returns the current hour.
Date::iso_8601() date.rs fn iso_8601() Returns the current date and time in ISO 8601 format.
Date::microsecond() date.rs fn microsecond() Returns the current microsecond.
Date::millisecond() date.rs fn millisecond() Returns the current millisecond.
Date::minute() date.rs fn minute() Returns the current minute.
Date::month() date.rs fn month() Returns the current month.
Date::nanosecond() date.rs fn nanosecond() Returns the current nanosecond.
Date::now_utc() date.rs fn now_utc() Returns the current date and time in UTC format.
Date::second() date.rs fn second() Returns the current second.
Date::timestamp() date.rs fn timestamp() Returns the current timestamp.
Date::weekday() date.rs fn weekday() Returns the current weekday.
Date::year() date.rs fn year() Returns the current year.

2) Hash functions

The Hash functions are used to generate hashes for various data types.

Open to view the Hash functions available in the library

Function Include File Function Prototype Description
Hash::entropy hash.rs fn entropy() Returns the entropy of a string.
Hash::generate_hash hash.rs fn generate_hash() Generates a hash for a string.
Hash::hash hash.rs fn hash() Returns the hash of a string.
Hash::hash_length hash.rs fn hash_length() Returns the length of a hash.
Hash::new hash.rs fn new() Creates a new hash instance.
Hash::password hash.rs fn password() Returns the hash of a password.
Hash::password_length hash.rs fn password_length() Returns the length of a password hash.
Hash::set_hash hash.rs fn set_hash() Sets the hash for a string.
Hash::set_password hash.rs fn set_password() Sets the hash for a password.
Hash::verify hash.rs fn verify() Verifies a hash.

3) Log functions

The Log functions are used to log messages to the console.

Open to view the Log functions available in the library

Function Include File Function Prototype Description
Log::log() log.rs fn log() Logs a message to the console.
Log::new() log.rs fn new() Creates a new log instance.

4) Password functions

The Password functions are used to generate passwords and verify passwords.

Open to view the Password functions available in the library

Function Include File Function Prototype Description
Password::entropy password.rs fn entropy() Returns the entropy of a string.
Password::hash_length password.rs fn hash_length() Returns the length of a hash.
Password::hash password.rs fn hash() Returns the hash of a password.
Password::is_empty password.rs fn is_empty() Checks if a password is empty.
Password::len password.rs fn len() Returns the length of a password.
Password::new password.rs fn new() Creates a new password instance.
Password::passphrase password.rs fn passphrase() Generates a passphrase.
Password::password_length password.rs fn password_length() Returns the length of a password hash.
Password::set_passphrase password.rs fn set_passphrase() Sets a passphrase.

5) QRCode functions

The QRCode functions are used to generate QRCode images and data.

Open to view the QRCode functions available in the library

Function Include File Function Prototype Description
QRCode::colorize() qrcode.rs fn colorize() Colorizes the QRCode instance.
QRCode::from_bytes() qrcode.rs fn from_bytes() Creates a new QRCode instance from a byte array.
QRCode::from_string() qrcode.rs fn from_string() Creates a new QRCode instance from a string.
QRCode::new() qrcode.rs fn new() Creates a new QRCode instance.
QRCode::resize() qrcode.rs fn resize() Resizes the QRCode instance.
QRCode::to_png() qrcode.rs fn to_png() Converts the QRCode instance to a PNG image.
QRCode::to_qrcode() qrcode.rs fn to_qrcode() Converts the QRCode instance to a QRCode image.
QRCode::to_svg() qrcode.rs fn to_svg() Converts the QRCode instance to a SVG image.

6) Random number functions

The Random number functions are used to generate random numbers in a variety of sizes and formats.

Open to view the Random number functions available in the library

Function Include File Function Prototype Description
Random::bytes() random.rs fn bytes() Generates a vector of random bytes of a given length.
Random::default() random.rs fn default() Creates a new Random struct with a default seed.
Random::float() random.rs fn float() Generates a random floating point number between 0 and 1.
Random::int() random.rs fn int() Generates a random integer between a minimum and maximum value.
Random::new() random.rs fn new() Creates a new Random struct with a seed based on the current system time.
Random::pseudo() random.rs fn pseudo() Generates a pseudo-random number by XORing the last 31 random numbers together.
Random::random() random.rs fn random() Generates a random number using the linear congruential generator algorithm. The multiplier for the algorithm is the golden ratio.

7) UUID functions

The UUID functions are used to generate UUIDs (Universally Unique Identifiers).

Open to view the UUID functions available in the library

Function Include File Function Prototype Description
UUID::new() uuid.rs fn new() Creates a new UUID instance based on the version specified. (v3, v4, v5)
UUID::uuid_v3() uuid.rs fn uuid_v3() Creates a new UUID v3 instance.
UUID::uuid_v4() uuid.rs fn uuid_v4() Creates a new UUID v4 instance.
UUID::uuid_v5() uuid.rs fn uuid_v5() Creates a new UUID v5 instance.

Semantic Versioning Policy đŸšĨ

For transparency into our release cycle and in striving to maintain backward compatibility, Mini Functions follows semantic versioning.

License 📝

The project is licensed under the terms of both the MIT license and the Apache License (Version 2.0).

Contribution 🤝

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

divider

Acknowledgements 💙

A big thank you to all the awesome contributors of Mini Functions for their help and support.

Dependencies

~9MB
~136K SLoC