Skip to content

Commit

Permalink
Changed callback type to FnOnce
Browse files Browse the repository at this point in the history
  • Loading branch information
Gurgel100 committed Oct 30, 2023
1 parent 71f540b commit 5a8235a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions msfs/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{

use crate::sys;

type NetworkCallback = Box<dyn Fn(NetworkRequest, i32)>;
type NetworkCallback = Box<dyn FnOnce(NetworkRequest, i32)>;

/// A builder to build network requests
pub struct NetworkRequestBuilder<'a> {
Expand Down Expand Up @@ -41,7 +41,7 @@ impl<'a> NetworkRequestBuilder<'a> {

/// Set a callback which will be called after the request finished or failed.
/// The parameters are the network request and the http status code (negative if failed)
pub fn with_callback(mut self, callback: impl Fn(NetworkRequest, i32) + 'static) -> Self {
pub fn with_callback(mut self, callback: impl FnOnce(NetworkRequest, i32) + 'static) -> Self {
self.callback = Some(Box::new(Box::new(callback)));
self
}
Expand Down

0 comments on commit 5a8235a

Please sign in to comment.