azure_canary_core/lib.rs
1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License.
3
4#![doc = include_str!("../README.md")]
5#![cfg_attr(docsrs, feature(doc_cfg))]
6#![warn(missing_docs)]
7
8/// Core numeric traits and types
9pub mod numeric {
10 /// Core trait for numeric operations
11 ///
12 /// Provides basic numeric functionality that should be
13 /// implemented by all numeric types in the SDK.
14 pub trait NumericCore {
15 /// Validates the numeric value
16 fn is_valid(&self) -> bool;
17
18 /// Converts the value to a string representation
19 fn to_string(&self) -> String;
20 }
21}
22
23pub use numeric::NumericCore;
24
25/// Adds two `u64` values and returns the result.
26///
27/// # Examples
28/// ```
29/// # use azure_canary_core::add;
30/// let sum = add(5, 10);
31/// assert_eq!(sum, 15);
32/// ```
33pub fn add(left: u64, right: u64) -> u64 {
34 left + right
35}
36
37#[cfg(test)]
38mod tests {
39 use super::*;
40
41 #[test]
42 fn it_works() {
43 let result = add(2, 2);
44 assert_eq!(result, 4);
45 }
46}