Crates.io | positivity |
lib.rs | positivity |
version | 1.0.0 |
source | src |
created_at | 2024-05-04 03:12:15.597073 |
updated_at | 2024-05-04 03:12:15.597073 |
description | A Rust library for checking the non-negativity of values across various types. |
homepage | |
repository | https://github.com/Jack17432/positivity |
max_upload_size | |
id | 1229369 |
size | 20,391 |
Welcome to positivity
, a Rust crate meticulously crafted to ascertain the non-negativity of values transcending a spectrum of types within the realm of computable contexts. This crate is a beacon of utility for developers requiring a robust, generic interface to assess whether values uphold a condition of being greater than or equal to their intrinsic default state.
positivity
operates seamlessly across any conceivable type that adheres to the traits PartialOrd
and Default
. This design paradigm ensures maximal applicability and utility across disparate data types, fostering an environment of computational generality and flexibility.To integrate positivity
into your Rust-based software ecosystem, append the following declaration to your project's Cargo.toml:
[dependencies]
positivity = "0.1.0"
Embark on your journey with positivity
through this elementary example:
use positivity::is_positive;
fn main() {
let num = 42;
let result = is_positive(num);
println!("Is the number positive? {}", result); // Elegantly outputs: Is the number positive? true
}
The central function of positivity
, is_positive
, offers a gateway into the evaluation of non-negativity, predicated on the principles of partial order theory relative to a type's default state.
pub fn is_positive<T: PartialOrd + Default>(value: T) -> bool
This signature delineates a function that imparts a boolean verdict, affirming true if the value surpasses or meets its default condition, false otherwise.
Explore the robustness of positivity
with these detailed examples:
assert_eq!(is_positive(0), true); // Affirms that zero is non-negative, adhering to the conventions of integer types.
assert_eq!(is_positive(-1), false); // Rightly identifies negative one as a negative value.
assert_eq!(is_positive(0.0), true); // Floating-point zero is confirmed as non-negative.
We cordially invite contributions that enhance the functionality, documentation, or utility of positivity
. Prospective contributions may include, but are not limited to:
Prior to contributing, kindly peruse the CONTRIBUTING.md document, which provides a comprehensive framework for contributions.
positivity
is dual-licensed under the terms of the MIT license, offering a framework of legal protection and open-source commitment.
Refer to LICENSE-MIT for comprehensive legal texts.
positivity
was conceived and nurtured into existence by Chris Graham, in collaboration with a cadre of other contributors whose intellectual investments have significantly shaped this project.