diff --git a/src/rust/api/client.rs b/src/rust/api/client.rs index 96ae45f991..de2b3ba298 100644 --- a/src/rust/api/client.rs +++ b/src/rust/api/client.rs @@ -103,7 +103,7 @@ pub struct ServerMessage { /// /// It contains methods to deal with all common issues, as well with the ones related to /// uploading media -pub trait Delegate { +pub trait Delegate: Send { /// Called at the beginning of any API request. The delegate should store the method /// information if he is interesting in knowing more context when further calls to it /// are made. diff --git a/src/rust/lib.rs b/src/rust/lib.rs index acd9febc4d..378d92243c 100644 --- a/src/rust/lib.rs +++ b/src/rust/lib.rs @@ -97,6 +97,15 @@ bar\r\n\ Ok(Chunk { first: 2, last: 42 }) ) } + + #[test] + fn dyn_delegate_is_send() { + fn with_send(x: impl Send) {} + + let mut dd = DefaultDelegate::default(); + let dlg: &mut dyn Delegate = &mut dd; + with_send(dlg); + } } #[cfg(test)]