-
Rust] Auto Convert T to Option<T>코딩Coding/★Rust★기초★Syntax 2022. 3. 2. 00:37728x90
https://users.rust-lang.org/t/auto-convert-t-to-option-t/45115
Auto convert T to Option<T>
I have a function fn some_func(num: Option<u32>){ match num{ Some(val) => ...., None => ...., } } I want to call it like some_func(3); instead of some_func(Some(3)); What is a good way to do this? I tried to implement From<u32> for Option<u32> impl From<u3
users.rust-lang.org
반응형'코딩Coding > ★Rust★기초★Syntax' 카테고리의 다른 글
How to create a simple in Rust (0) 2022.03.02 "I'm a C++ developer, it took me a week to learn Rust" (0) 2022.03.02 A Rust tutorial for experienced C and C++ programmers. (0) 2022.03.02 Rust -Options and Results (0) 2022.03.02 한국 블로그 러스트 정리 잘됨. (0) 2022.02.28 Rust소유권 규칙Ownership Rules &Borrowing rules (0) 2022.02.28 Rust]메모리 주소를 벡터에 넣고 출력test해보기!) Print elements in a vector contiguously (0) 2022.02.27 Vec<String> or Vec<&str> for function argument? (0) 2022.02.26