Struct msfs::network::NetworkRequestBuilder
source · pub struct NetworkRequestBuilder<'a> { /* private fields */ }
Expand description
A builder to build network requests
Implementations§
source§impl<'a> NetworkRequestBuilder<'a>
impl<'a> NetworkRequestBuilder<'a>
sourcepub fn with_header(self, header: &str) -> Option<Self>
pub fn with_header(self, header: &str) -> Option<Self>
Set a HTTP header
sourcepub fn with_callback(
self,
callback: impl FnOnce(NetworkRequest, i32) + 'static
) -> Self
pub fn with_callback( self, callback: impl FnOnce(NetworkRequest, i32) + 'static ) -> Self
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)
sourcepub fn get(self) -> Option<NetworkRequest>
pub fn get(self) -> Option<NetworkRequest>
Do HTTP GET request
sourcepub fn post(self, post_field: &str) -> Option<NetworkRequest>
pub fn post(self, post_field: &str) -> Option<NetworkRequest>
Do HTTP POST request
sourcepub fn put(self) -> Option<NetworkRequest>
pub fn put(self) -> Option<NetworkRequest>
Do HTTP PUT request
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for NetworkRequestBuilder<'a>
impl<'a> !Send for NetworkRequestBuilder<'a>
impl<'a> !Sync for NetworkRequestBuilder<'a>
impl<'a> Unpin for NetworkRequestBuilder<'a>
impl<'a> !UnwindSafe for NetworkRequestBuilder<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more