actix_multipart_extract/
config.rs1use actix_web::HttpResponse;
2
3use crate::MultipartError;
4
5type MultipartErrorHandler = Box<dyn Fn(MultipartError) -> HttpResponse + Send + Sync + 'static>;
6
7pub struct MultipartConfig {
9 pub error_handler: Option<MultipartErrorHandler>,
10}
11
12impl MultipartConfig {
13 pub fn set_error_handler<F>(mut self, error_handler: F) -> Self
14 where
15 F: Fn(MultipartError) -> HttpResponse + Send + Sync + 'static,
16 {
17 self.error_handler = Some(Box::new(error_handler));
18 self
19 }
20}
21
22impl Default for MultipartConfig {
23 fn default() -> Self {
24 Self {
25 error_handler: None,
26 }
27 }
28}