加入https://doc.rust-lang.org/std/str/struct.Split.html有一个关于字符串rev结果的方法split
我收到以下错误
error: the trait `core::str::pattern::DoubleEndedSearcher<'_>` is not
implemented for the type `core::str::pattern::StrSearcher<'_, '_>` [E0277]
for part in "1:30".split(":").rev() {
Run Code Online (Sandbox Code Playgroud)
我用过的代码
let mut length = 0;
let mut mult = 1;
for part in "1:30".split(":").rev() {
length += mult * part.parse::<i32>().unwrap();
mult *= 60;
}
Run Code Online (Sandbox Code Playgroud)