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