-
Vec<String> or Vec<&str> for function argument?코딩Coding/★Rust★기초★Syntax 2022. 2. 26. 21:48728x90
Vec<String> or Vec<&str> for function argument?
I have been using `String` for struct to avoid lifetime issue, and `&str` for functions argument. But I am uncertain about using compound type as function argument.
If I am not mutating the argument, should I use `Vec<String>` or `Vec<&str>`? Is there any benefit for choosing a particular one?반응형'코딩Coding > ★Rust★기초★Syntax' 카테고리의 다른 글
Rust] Auto Convert T to Option<T> (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 WebGPU]Building WebGPU with Rust- Code Geek (0) 2022.02.25 Rust_slices]❤️String Literals Are Slices (0) 2022.02.25 Rust]❤️String ->as_bytes메소드를 이용해 바이트 배열로 변환 (0) 2022.02.25 Using unsafe 관련 글(The Rustonomicon=unsafe설명서Rust) -Reddit-learnrust (0) 2022.02.24