Skip to content

Commit b6a54f7

Browse files
authored
Create FunctionWithGenerics.rs
1 parent 61d660e commit b6a54f7

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Function/FunctionWithGenerics.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
fn main() {
2+
let int_result = identity(42);
3+
let str_result = identity("Hello");
4+
println!("IntResult: {}, StrResult: {}", int_result, str_result);
5+
}
6+
7+
fn identity<T>(value: T) -> T {
8+
value
9+
}

0 commit comments

Comments
 (0)