#order #default #default-value #generic #partial-order

positivity

A Rust library for checking the non-negativity of values across various types

1 stable release

1.0.0 May 4, 2024

#1702 in Algorithms

MIT license

15KB

Positivity: An Exposition on Non-Negativity

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.

Table of Contents

Comprehensive Feature Synopsis

  • Generic Implementation Par Excellence: 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.
  • Optimized for Minimal Computational Overhead: Engineered for efficiency, this crate imposes minimal performance penalties, making it ideally suited for high-performance computing scenarios where computational resources are at a premium.
  • Extensively Documented for Maximum Edification: Each function within this crate is accompanied by exhaustive documentation that not only elucidates its operational mechanics but also explores the philosophical underpinnings of its functionality.

Initiation into Positivity

Installation Procedure

To integrate positivity into your Rust-based software ecosystem, append the following declaration to your project's Cargo.toml:

[dependencies]
positivity = "0.1.0"

Primer on Usage

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
}

In-Depth Documentation and Typographical Conventions

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.

Signature of Functionality

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.

Illustrative Examples

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.

Participatory Contribution Guidelines

We cordially invite contributions that enhance the functionality, documentation, or utility of positivity. Prospective contributions may include, but are not limited to:

  • Enhancements and feature augmentations
  • Amplifications of the existing documentation
  • Reporting discrepancies and articulating feature requisitions

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.

Custodianship and Authorship

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.

Expressions of Gratitude

  • Profound thanks are extended to the Rust community, whose unfaltering support and insightful feedback have been pivotal.
  • Gratitude is also due to all individuals and entities that have contributed to the conceptualization, development, and refinement of

No runtime deps