sqrtx

Crates.iosqrtx
lib.rssqrtx
version0.1.4
sourcesrc
created_at2024-11-20 11:36:21.428136
updated_at2024-12-04 21:07:46.23784
descriptionSquare root calculation
homepage
repositoryhttps://github.com/MarioHabor/sqrtx
max_upload_size
id1454649
size9,716
Mario Habor (MarioHabor)

documentation

README

SqrtCalculator

Crates.io Docs.rs

A Rust library for calculating square roots asynchronously and synchronously, optimized for high-performance workloads. Includes robust error handling and support for parallel processing.

Table of Contents

Installation

Add the following to your Cargo.toml file:

[dependencies]
sqrtx = "0.1.2"

5. Usage

Usage

Synchronous Example

use sqrtx::square_root;

fn main() {
    let result = square_root(144.0).unwrap();
    println!("The square root is {}", result);
}

Asynchronous Example

use sqrtx::square_root_async;

#[tokio::main]
async fn main() {
    let result = square_root_async(144.0).await.unwrap();
    println!("The square root is {}", result);
}

6. Features

Features

  • Supports synchronous and asynchronous computations.

  • Parallel processing for heavy workloads.

  • Comprehensive error handling.

  • Lightweight and fast.

Examples

Parallel Processing

use sqrtx::square_roots_parallel;

#[tokio::main]
async fn main() {
    let numbers = vec![4.0, 16.0, 25.0];
    let results = square_roots_parallel(numbers).await.unwrap();
    println!("The square roots are: {:?}", results);
}

License

This project is licensed under the MIT License. See the LICENSE file for details.

Commit count: 6

cargo fmt