use official async trait (#6765)

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2023-12-29 16:41:49 +08:00 committed by GitHub
parent 6953efc2d8
commit e873188775
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 3 additions and 9 deletions

1
Cargo.lock generated
View File

@ -5236,7 +5236,6 @@ dependencies = [
"android_logger",
"arboard",
"async-process",
"async-trait",
"base64",
"bytes",
"cc",

View File

@ -60,7 +60,6 @@ magnum-opus = { git = "https://github.com/rustdesk/magnum-opus" }
dasp = { version = "0.11", features = ["signal", "interpolate-linear", "interpolate"], optional = true }
rubato = { version = "0.12", optional = true }
samplerate = { version = "0.2", optional = true }
async-trait = "0.1"
uuid = { version = "1.3", features = ["v4"] }
clap = "4.2"
rpassword = "7.2"

View File

@ -41,7 +41,6 @@ impl Session {
}
}
#[async_trait]
impl Interface for Session {
fn get_login_config_handler(&self) -> Arc<RwLock<LoginConfigHandler>> {
return self.lc.clone();

View File

@ -6,7 +6,6 @@ use std::{
sync::{mpsc, Arc, Mutex, RwLock},
};
pub use async_trait::async_trait;
use bytes::Bytes;
#[cfg(not(any(target_os = "android", target_os = "linux")))]
use cpal::{
@ -2649,7 +2648,6 @@ async fn send_switch_login_request(
}
/// Interface for client to send data and commands.
#[async_trait]
pub trait Interface: Send + Clone + 'static + Sized {
/// Send message data to remote peer.
fn send(&self, data: Data);

View File

@ -741,10 +741,11 @@ fn try_broadcast_display_changed(
) {
log::info!("Display {} changed", display);
if let Some(msg_out) = make_display_changed_msg(display_idx, Some(display)) {
sp.send(msg_out.clone());
let msg_out = Arc::new(msg_out);
sp.send_shared(msg_out.clone());
// switch display may occur before the first video frame, add snapshot to send to new subscribers
sp.snapshot(move |sps| {
sps.send(msg_out.clone());
sps.send_shared(msg_out.clone());
Ok(())
})?;
bail!("SWITCH");

View File

@ -2,7 +2,6 @@ use crate::{
common::{get_supported_keyboard_modes, is_keyboard_mode_supported},
input::{MOUSE_BUTTON_LEFT, MOUSE_TYPE_DOWN, MOUSE_TYPE_UP, MOUSE_TYPE_WHEEL},
};
use async_trait::async_trait;
use bytes::Bytes;
use rdev::{Event, EventType::*, KeyCode};
use std::{
@ -1305,7 +1304,6 @@ impl<T: InvokeUiSession> DerefMut for Session<T> {
impl<T: InvokeUiSession> FileManager for Session<T> {}
#[async_trait]
impl<T: InvokeUiSession> Interface for Session<T> {
fn get_lch(&self) -> Arc<RwLock<LoginConfigHandler>> {
return self.lc.clone();