5个不稳定版本
使用旧的Rust 2015
| 0.3.0 | 2017年12月29日 | 
|---|---|
| 0.2.2 | 2017年12月29日 | 
| 0.2.1 | 2017年12月29日 | 
| 0.2.0 | 2017年12月28日 | 
| 0.1.0 | 2017年12月28日 | 
1152 in 数学
7KB
91 代码行
newtonmath
newtonmath是Newton API的Rust包装器,一个真正微小的微服务,用于高级数学。
实现的功能
fn simplify(exp: &str) -> StringResult // /simplify endpoint
fn factor(exp: &str) -> StringResult // /factor endpoint
fn derive(exp: &str) -> StringResult // /derive endpoint
fn integrate(exp: &str) -> StringResult // /integrate endpoint
fn find_zeroes(exp: &str) -> VectorResult // /zeroes endpoint
fn find_tangent(exp: &str) -> StringResult // /tangent endpoint
fn area_under_curve(exp: &str) -> StringResult // /area endpoint
fn cosine(exp: &str) -> StringResult // /cos endpoint
fn sine(exp: &str) -> StringResult // /sin endpoint
fn tangent(exp: &str) -> StringResult // /tan endpoint
fn inverse_cosine(exp: &str) -> StringResult // /arccos endpoint
fn inverse_sine(exp: &str) -> StringResult // /arcsin endpoint
fn inverse_tangent(exp: &str) -> StringResult // /arctan endpoint
fn absolute_value(exp: &str) -> StringResult // /abs endpoint
fn logarithm(exp: &str) -> StringResult // /log endpoint
返回的StringResult是类型Result<String, reqwest::Error>,而返回的VectorResult是类型Result<Vec<i64>, reqwest::Error>。
设置
- 将newtonmath添加到您的Cargo.toml中的依赖项
[dependencies]
newtonmath = "0.3.0"
- 将其包含在您的代码中
extern crate newtonmath as newton;
用法
fn main(){
    let res = newton::derive("x^2-1");
    match res {
        Ok(data) => println!("{}", data), // "2 x"
        Err(err) => println!("{:?}",err) // If an error is returned
    };
}
依赖项
~14–23MB
~411K SLoC