Max*_*Max 3 rust
假设我定义一个带有字符串字段的结构。该领域应该:
format
我如何用Rust 表达这个(“要么”)&str?String
&str
String
Cha*_*man 8
有一个内置类型( C lone On W ritestd::borrow::Cow的缩写)。通过指定,您可以存储以及。derefs 以便您可以调用方法,并在需要调用方法时提供和方法。Cow<'a, str>&'a strStringCowstrstrto_mut()into_owned()String
std::borrow::Cow
Cow<'a, str>
&'a str
Cow
str
to_mut()
into_owned()
归档时间:
2 年,6 月 前
查看次数:
258 次
最近记录: