struct_PathBuf
struct_PathBuf (소유 경로 구조체)
소유되어 있고 변경 가능한 경로(String에 가깝게)예요.
출처: Rust 공식 문서
본문
이 타입은 경로를 제자리에서 변경하는 push와 set_extension 같은 메서드를 제공해요. 또한 Path에 대한 Deref를 구현하므로 모든 Path 메서드를 PathBuf 값에서 직접 호출할 수 있어요.
pub struct PathBuf { /* private fields */ }
예시
use std::path::PathBuf;
let mut path = PathBuf::from("/foo");
path.push("bar.txt");
assert_eq!(path, PathBuf::from("/foo/bar.txt"));