Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Jul 8, 2024
1 parent d5f767c commit 760e9a8
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions plugins/http/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,6 @@ struct FetchRequest {
}
impl tauri::Resource for FetchRequest {}

impl FetchRequest {
fn new(
fut: CancelableResponseFuture,
abort_tx_rid: ResourceId,
abort_rx_rid: ResourceId,
) -> Self {
Self {
fut: Mutex::new(fut),
abort_tx_rid,
abort_rx_rid,
}
}
}

struct AbortSender(Sender<()>);
impl tauri::Resource for AbortRecveiver {}

Expand All @@ -70,7 +56,11 @@ impl AddRequest for ResourceTable {
fn add_request(&mut self, fut: CancelableResponseFuture) -> ResourceId {
let (tx, rx) = channel::<()>();
let (tx, rx) = (AbortSender(tx), AbortRecveiver(rx));
let req = FetchRequest::new(fut, self.add(tx), self.add(rx));
let req = FetchRequest {
fut: Mutex::new(fut),
abort_tx_rid: self.add(tx),
abort_rx_rid: self.add(rx),
};
self.add(req)
}
}
Expand Down

0 comments on commit 760e9a8

Please sign in to comment.