Explicitly specify Send requirement where dyn traits are used (#296)

This commit is contained in:
Sebastian Thiel
2021-08-26 09:05:39 +08:00
parent b2274caac4
commit 74621c9c37
2 changed files with 5 additions and 5 deletions

View File

@@ -738,9 +738,9 @@ else {
mp_reader.add_part(&mut request_value_reader, request_size, json_mime_type.clone())
.add_part(&mut reader, size, reader_mime_type.clone());
let mime_type = mp_reader.mime_type();
(&mut mp_reader as &mut dyn io::Read, (CONTENT_TYPE, mime_type.to_string()))
(&mut mp_reader as &mut (dyn io::Read + Send), (CONTENT_TYPE, mime_type.to_string()))
},
_ => (&mut request_value_reader as &mut dyn io::Read, (CONTENT_TYPE, json_mime_type.to_string())),
_ => (&mut request_value_reader as &mut (dyn io::Read + Send), (CONTENT_TYPE, json_mime_type.to_string())),
};
% endif
let client = &self.hub.client;

View File

@@ -360,8 +360,8 @@ const BOUNDARY: &str = "MDuXWGyeE33QFXGchb2VFWc4Z7945d";
/// to google APIs, and might not be a fully-featured implementation.
#[derive(Default)]
pub struct MultiPartReader<'a> {
raw_parts: Vec<(HeaderMap, &'a mut dyn Read)>,
current_part: Option<(Cursor<Vec<u8>>, &'a mut dyn Read)>,
raw_parts: Vec<(HeaderMap, &'a mut (dyn Read + Send))>,
current_part: Option<(Cursor<Vec<u8>>, &'a mut (dyn Read + Send))>,
last_part_boundary: Option<Cursor<Vec<u8>>>,
}
@@ -384,7 +384,7 @@ impl<'a> MultiPartReader<'a> {
/// `mime` - It will be put onto the content type
pub fn add_part(
&mut self,
reader: &'a mut dyn Read,
reader: &'a mut (dyn Read + Send),
size: u64,
mime_type: Mime,
) -> &mut MultiPartReader<'a> {