Skip to content
Snippets Groups Projects
Commit 5d26bff5 authored by nutzer05's avatar nutzer05
Browse files

Add crate docs

parent c6f4dbaa
No related branches found
No related tags found
No related merge requests found
//! API helpers for a calculator API
//!
//! Use this crate to implement highly critical
//! enterprise-grade maths AI systems.
use log::debug; use log::debug;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
...@@ -27,7 +32,7 @@ pub struct CalcReq { ...@@ -27,7 +32,7 @@ pub struct CalcReq {
} }
/// Result of a calculation of the calculator API /// Result of a calculation of the calculator API
#[derive(Serialize)] #[derive(Debug, PartialEq, Serialize)]
pub struct CalcRes { pub struct CalcRes {
/// Result of the calculation /// Result of the calculation
res: i32, res: i32,
...@@ -55,4 +60,10 @@ impl CalcReq { ...@@ -55,4 +60,10 @@ impl CalcReq {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
#[test]
fn two_plus_two() {
let req = CalcReq{ a: 2, b: 2, op: CalcOp::Add };
assert_eq!(req.calc(), Some(CalcRes{ res: 4}));
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment