我有以下模块:
mod types {
use std::str::FromStr;
struct StringParseError;
pub enum ProcStat {
PSRunning,
}
impl FromStr for ProcStat {
type Err = StringParseError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"R" => Ok(PSRunning),
}
}
}
}
在建造时,我得到了:
error[E0425]: cannot find value `PSRunning` in this scope
--> src/lib.rs:15:27
|
15 | "R" => Ok(PSRunning),
| ^^^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
|
2 | use crate::types::ProcStat::PSRunning;
|
这里的正确用法是什么?我可能已经错过了文档中的这一部分。