Created
October 28, 2022 10:46
-
-
Save helloobaby/c41e76711a23b2bf1488b8f7609383ec to your computer and use it in GitHub Desktop.
rust 模板函数
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use warp::Filter; | |
| fn template_fn<F:std::ops::Add<Output=F> + From<i32> >(mut num: F) -> F{ | |
| num = num + 2.into(); | |
| num | |
| } | |
| fn main() { | |
| println!("{}",template_fn(2)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment