async_client: Remove the response callbacks.

master
Damir Jelić 2019-12-04 22:35:19 +01:00
parent e21806f3cc
commit 5688b2e70a
1 changed files with 0 additions and 19 deletions

View File

@ -29,9 +29,6 @@ use crate::VERSION;
type RoomEventCallback = type RoomEventCallback =
Box<dyn FnMut(Arc<RwLock<Room>>, Arc<EventResult<RoomEvent>>) -> BoxFuture<'static, ()> + Send>; Box<dyn FnMut(Arc<RwLock<Room>>, Arc<EventResult<RoomEvent>>) -> BoxFuture<'static, ()> + Send>;
type ResponseCallback =
Box<dyn FnMut(Arc<sync_events::IncomingResponse>) -> BoxFuture<'static, ()> + Send>;
#[derive(Clone)] #[derive(Clone)]
pub struct AsyncClient { pub struct AsyncClient {
/// The URL of the homeserver to connect to. /// The URL of the homeserver to connect to.
@ -44,8 +41,6 @@ pub struct AsyncClient {
transaction_id: Arc<AtomicU64>, transaction_id: Arc<AtomicU64>,
/// Event callbacks /// Event callbacks
event_callbacks: Arc<Mutex<Vec<RoomEventCallback>>>, event_callbacks: Arc<Mutex<Vec<RoomEventCallback>>>,
// /// Response callbacks.
response_callbacks: Arc<Mutex<Vec<ResponseCallback>>>,
} }
#[derive(Default, Debug)] #[derive(Default, Debug)]
@ -162,7 +157,6 @@ impl AsyncClient {
base_client: Arc::new(RwLock::new(BaseClient::new(session))), base_client: Arc::new(RwLock::new(BaseClient::new(session))),
transaction_id: Arc::new(AtomicU64::new(0)), transaction_id: Arc::new(AtomicU64::new(0)),
event_callbacks: Arc::new(Mutex::new(Vec::new())), event_callbacks: Arc::new(Mutex::new(Vec::new())),
response_callbacks: Arc::new(Mutex::new(Vec::new())),
}) })
} }
@ -183,19 +177,6 @@ impl AsyncClient {
futures.push(Box::new(future)); futures.push(Box::new(future));
} }
pub fn add_response_callback<C: 'static>(
&mut self,
mut callback: impl FnMut(Arc<sync_events::IncomingResponse>) -> C + 'static + Send,
) where
C: Future<Output = ()> + Send,
{
let mut futures = self.response_callbacks.lock().unwrap();
let future = move |response| callback(response).boxed();
futures.push(Box::new(future));
}
pub async fn login<S: Into<String>>( pub async fn login<S: Into<String>>(
&mut self, &mut self,
user: S, user: S,