std::io
에서 오류 처리가 완료되는 방식을 다시 만들려고합니다. 내 코드는 this 문서에 있습니다.열거 형 값을 볼 수 없습니다.
내 문제는 내 코드를 별도의 mod
에 넣었으므로 반환하려는 열거 형 값을 볼 수 없습니다. 코드 샘플 :
mod error {
use std::str::SendStr;
pub type ProgramResult<T> = Result<T, ProgramError>;
#[deriving(Show)]
pub struct ProgramError {
kind: ProgramErrorKind,
message: SendStr
}
/// The kinds of errors that can happen in our program.
/// We'll be able to pattern match against these.
#[deriving(Show)]
pub enum ProgramErrorKind {
Configuration
}
impl ProgramError {
pub fn new<T: IntoMaybeOwned<'static>>(msg: T, kind: ProgramErrorKind) -> ProgramError {
ProgramError {
kind: kind,
message: msg.into_maybe_owned()
}
}
}
}
나는 열거 대중 정당이를 사용하려고 다른 모든 개조 수입에도 불구하고, 내 코드에 다른 곳 Configuration
를 볼 수 없습니다. 어떤 아이디어?
'use error :: Configuration'을 했습니까? – Levans