Remove Send + Sync bounds from callbacks

This commit is contained in:
asonix 2022-09-24 16:22:00 -05:00
parent 3525bcd09c
commit a2e1ffa091

View file

@ -158,8 +158,6 @@ pub type FileFn<T, E> = Box<
Mime,
Pin<Box<dyn Stream<Item = Result<Bytes, Error>>>>,
) -> Pin<Box<dyn Future<Output = Result<T, E>>>>
+ Send
+ Sync,
>;
/// The field type represents a field in the form-data that is allowed to be parsed.
@ -218,8 +216,6 @@ impl<T, E> Field<T, E> {
pub fn file<F, Fut>(f: F) -> Self
where
F: Fn(String, Mime, Pin<Box<dyn Stream<Item = Result<Bytes, Error>>>>) -> Fut
+ Send
+ Sync
+ Clone
+ 'static,
Fut: Future<Output = Result<T, E>> + 'static,
@ -477,7 +473,7 @@ pub struct Form<T, E> {
pub(crate) max_field_size: usize,
pub(crate) max_files: u32,
pub(crate) max_file_size: usize,
pub(crate) transform_error: Option<Box<dyn Fn(Error) -> actix_web::Error + Send + Sync>>,
pub(crate) transform_error: Option<Box<dyn Fn(Error) -> actix_web::Error + Sync>>,
inner: Map<T, E>,
}
@ -511,7 +507,7 @@ impl<T, E> Form<T, E> {
/// Set the Transform Error method to convert Error types into actix_web::Error by hand
pub fn transform_error(
mut self,
f: impl Fn(Error) -> actix_web::Error + Send + Sync + 'static,
f: impl Fn(Error) -> actix_web::Error + Sync + 'static,
) -> Self {
self.transform_error = Some(Box::new(f));
self