# calc **Repository Path**: dnrops/calc ## Basic Information - **Project Name**: calc - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-05-02 - **Last Updated**: 2021-05-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # calc [![Build Status](https://travis-ci.org/redox-os/calc.svg?branch=master)](https://travis-ci.org/redox-os/calc) [![crates.io](https://meritbadge.herokuapp.com/calculate)](https://crates.io/crates/calculate) `calc` is a Rust library for tokenizing and evaluating arithmetic expressions with a command line application of the same name included. **NOTE**: The name of the project, binary, and library are `calc` but the package name is `calculate`. This will remain depending on if this project can acquire the `calc` crate which is currently being squatted on. # Usage ## As a Library Add `calc` as a dependency in your `Cargo.toml`: ```toml [dependencies] calculate = "0.5.*" ``` Then make use of the library functions: ```rust extern crate calc; use calc::eval; use std::io::{self, BufRead, stdout, stdin, Write}; fn main() { let stdout = stdout(); let mut stdout = stdout.lock(); let stdin = stdin(); for line in stdin.lock().lines() { match line.unwrap().trim() { "" => (), "exit" => break, s => writeln!(stdout, "{}", eval(s)).unwrap(), } } } ``` ## As an Executable ```bash $ cargo install calculate ... $ calc ```