0
我正在使用rust-fuse,它将挂载选项设置为&[&std::ffi::os_str::OsStr]
。看来,我应该分割我的传入逗号分隔的选项字符串,我做的,像这样:什么是从&str转换为OsStr的正确方法?
let mut options: &[&str] = &[];
if (optstr!= "") {
options = optstr.split(",").collect::<Vec<_>>().as_slice();
}
fuse::mount(FS, &mountpoint, options)
其中提供了以下错误:
error: mismatched types:
expected `&[&std::ffi::os_str::OsStr]`,
found `&[&str]`
(expected struct `std::ffi::os_str::OsStr`,
found str) [E0308]
我的印象是,所有的&str
s也OsStr
s,但我是Rust的新手,所以我猜这是错误的。
关于堆栈溢出,预计会显示您在提问之前已完成的*研究。 **你尝试了什么?** – Shepmaster