mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-16 15:04:05 +00:00
22 lines
340 B
Rust
22 lines
340 B
Rust
|
#[cxx::bridge(namespace = rust)]
|
||
|
mod ffi {
|
||
|
extern "Rust" {
|
||
|
fn add(left: usize, right: usize) -> usize;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
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);
|
||
|
}
|
||
|
}
|