pub struct Http;
Expand description
Provides functions for doing http network request
Implementations
sourceimpl Http
impl Http
sourcepub fn fetch_with_text_response_decoder<APP, MSG, SUCCESS, ERROR>(
url: &str,
fetch_cb: SUCCESS,
error_cb: ERROR
) -> Cmd<Program<APP, MSG>> where
SUCCESS: 'static + Fn(String) -> MSG + Clone,
ERROR: 'static + Fn(TypeError) -> MSG + Clone,
APP: 'static + Application<MSG>,
MSG: 'static,
pub fn fetch_with_text_response_decoder<APP, MSG, SUCCESS, ERROR>(
url: &str,
fetch_cb: SUCCESS,
error_cb: ERROR
) -> Cmd<Program<APP, MSG>> where
SUCCESS: 'static + Fn(String) -> MSG + Clone,
ERROR: 'static + Fn(TypeError) -> MSG + Clone,
APP: 'static + Application<MSG>,
MSG: 'static,
fetch text document from the url and decode the result with the supplied response_text_decoder function
sourcepub fn fetch_with_request_and_response_decoder<APP, MSG, DECODER, ERROR>(
url: &str,
request_init: Option<RequestInit>,
decoder_dispatcher: DECODER,
error_cb: ERROR
) -> Cmd<Program<APP, MSG>> where
APP: 'static + Application<MSG>,
MSG: 'static,
DECODER: 'static + Fn((Response, Program<APP, MSG>)),
ERROR: 'static + Fn(TypeError) -> MSG,
pub fn fetch_with_request_and_response_decoder<APP, MSG, DECODER, ERROR>(
url: &str,
request_init: Option<RequestInit>,
decoder_dispatcher: DECODER,
error_cb: ERROR
) -> Cmd<Program<APP, MSG>> where
APP: 'static + Application<MSG>,
MSG: 'static,
DECODER: 'static + Fn((Response, Program<APP, MSG>)),
ERROR: 'static + Fn(TypeError) -> MSG,
API for fetching http rest request error_cb - request failed, in cases where a network is down, server is dead, etc.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Http
impl Send for Http
impl Sync for Http
impl Unpin for Http
impl UnwindSafe for Http
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more