dicoco_safe_math

Crates.iodicoco_safe_math
lib.rsdicoco_safe_math
version0.1.1
sourcesrc
created_at2024-05-13 00:45:11.288814
updated_at2024-05-13 22:06:20.875708
descriptionA Rust library for simplified safe math operations
homepagehttps://github.com/malledugean/rust_safe_math
repositoryhttps://github.com/malledugean/rust_safe_math.git
max_upload_size
id1237858
size7,519
Roberto Pavusa Junior (malledugean)

documentation

https://github.com/malledugean/rust_safe_math/blob/main/README.md

README

Project Safe Math for Rust logo

Project Safe Math for Rust

Status GitHub Issues GitHub Pull Requests License


A Rust library for simplified safe math operations.

📝 Table of Contents

🧐 About

Safe Math Rust is a Rust library designed to simplify and ensure safe mathematical operations. It provides functions that perform common arithmetic operations while preventing potential overflows and underflows that can lead to program crashes or unexpected behavior.

🏁 Getting Started

This guide will help you get started using Safe Math Rust in your projects.

Prerequisites

  • Rust compiler: Download and install Rust from the official website https://www.rust-lang.org/tools/install.
  • Basic understanding of Rust: Familiarity with core Rust concepts like functions, variables, and data types is recommended.

Installing

Add Safe Math Rust as a dependency in your Cargo.toml file:

content_copy

  1. Run cargo update to install the library.
Ini, TOML
[dependencies]
dicoco_safe_math = "0.1.0"

Use code with caution.

  1. Run cargo update to install the library.
cargo update

🔧 Running the tests

The library includes unit tests to ensure the functionality of its functions. To run the tests, navigate to your project directory in the terminal and execute:

Bash
cargo test

🎈 Usage

Safe Math Rust offers functions for various mathematical operations, all designed to handle potential overflows and underflows gracefully. Here are some examples:

use dicoco_safe_math::calc_basic;

fn main() {
  let a = 100;
  let b = 50;

  // Safe addition
  let safe_sum = calc_basic::sub_x_y(a,b);

  // Safe subtraction
  let safe_difference = calc_basic::sum_x_y(a,b);


  println!("Safe sum: {}", safe_sum);
  println!("Safe difference: {}", safe_difference);
}

🚀 Deployment

Once you have integrated Safe Math Rust into your project and are satisfied with its functionality, you can deploy your application following your preferred method for Rust projects. Common options include building standalone executables or deploying as a web service.

⛏️ Built Using

📜 License:

This project is licensed under the license Creative Commons Attribution 4.0 International (CC-BY-4.0).

✍️ Authors

🎉 Acknowledgements

  • NearX Rust learning
Commit count: 8

cargo fmt