INNER CODE UNIT · Rust

new

TheWaWaR/simple-http-server · src/handlers.rs:100

    fn new(status: StatusCode, message: impl Into<String>) -> Self {
        Self {
            status,
            message: message.into(),
        }
    }

    fn from_io(err: io::Error) -> Self {
        let status = match err.kind() {
            io::ErrorKind::PermissionDenied => StatusCode::FORBIDDEN,
            io::ErrorKind::NotFound => StatusCode::NOT_FOUND,
            _ => StatusCode::INTERNAL_SERVER_ERROR,
        };
        Self::new(status, err.to_string())
    }
}

impl EntityTag {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…