Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
webrechner_overengineered
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rust-kurs-2024-01
webrechner_overengineered
Commits
5d26bff5
Commit
5d26bff5
authored
1 year ago
by
nutzer05
Browse files
Options
Downloads
Patches
Plain Diff
Add crate docs
parent
c6f4dbaa
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wr_lib/src/lib.rs
+12
-1
12 additions, 1 deletion
wr_lib/src/lib.rs
with
12 additions
and
1 deletion
wr_lib/src/lib.rs
+
12
−
1
View file @
5d26bff5
//! 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
}));
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment