add_one fn

This commit is contained in:
Wyatt J. Miller 2022-10-01 16:14:00 -04:00
parent 2ff1449558
commit 4ceba40899

19
src/lib.rs Normal file
View File

@ -0,0 +1,19 @@
#[no_mangle]
pub extern "C" fn add_one(x: u32) -> u32 {
x + 1
}
pub fn add(left: usize, right: usize) -> usize {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}