Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn some_operation_ver1(param1: Option<&i32>) {
- let _x: Option<&i32> = param1;
- }
- fn some_operation_ver2<'a, T1: Into<Option<&'a i32>>>(param1: T1) {
- let _x: Option<&i32> = Into::into(param1);
- }
- fn main() {
- // Clean version
- some_operation_ver1(Some(&32)); // Must use Some
- // Complex version
- some_operation_ver2(Some(&32)); // Can use Some
- some_operation_ver2(&32); // Can also not use it
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement