Struct stdweb::web::XmlHttpRequest [−][src]
pub struct XmlHttpRequest(_);
Use XmlHttpRequest (XHR) objects to interact with servers. You can retrieve data from a URL without having to do a full page refresh. This enables a Web page to update just part of a page without disrupting what the user is doing. XmlHttpRequest is used heavily in Ajax programming.
Methods
impl XmlHttpRequest
[src]
impl XmlHttpRequest
pub fn new() -> XmlHttpRequest
[src]
pub fn new() -> XmlHttpRequest
Creates new XmlHttpRequest
.
pub fn ready_state(&self) -> XhrReadyState
[src]
pub fn ready_state(&self) -> XhrReadyState
Returns the current state of the request as a XhrReadyState.
pub fn response_text(&self) -> Result<Option<String>, TODO>
[src]
pub fn response_text(&self) -> Result<Option<String>, TODO>
Returns a string that contains the response to the request as text, or None if the request was unsuccessful or has not yet been sent.
pub fn status(&self) -> u16
[src]
pub fn status(&self) -> u16
Returns an unsigned short with the status of the response of the request.
pub fn open(&self, method: &str, url: &str) -> Result<(), TODO>
[src]
pub fn open(&self, method: &str, url: &str) -> Result<(), TODO>
Open connection with given method (ie GET or POST), and the url to hit.
pub fn get_response_header(&self, header: &str) -> Option<String>
[src]
pub fn get_response_header(&self, header: &str) -> Option<String>
Returns the string containing the text of the specified header. If there are multiple response headers with the same name, then their values are returned as a single concatenated string.
pub fn set_request_header(&self, header: &str, value: &str) -> Result<(), TODO>
[src]
pub fn set_request_header(&self, header: &str, value: &str) -> Result<(), TODO>
Sets the value of an HTTP request header. Must be called after open()
,
but before send()
. If this method is called several times with the same
header, the values are merged into one single request header.
pub fn send(&self) -> Result<(), TODO>
[src]
pub fn send(&self) -> Result<(), TODO>
Send request on an open connection with no data
pub fn send_with_string(&self, body: &str) -> Result<(), TODO>
[src]
pub fn send_with_string(&self, body: &str) -> Result<(), TODO>
Send request on an open connection with string body
pub fn send_with_bytes(&self, body: &[u8]) -> Result<(), TODO>
[src]
pub fn send_with_bytes(&self, body: &[u8]) -> Result<(), TODO>
Send request on an open connection with a byte array body
pub fn abort(&self)
[src]
pub fn abort(&self)
Aborts the request if it has already been sent. When a request is aborted, its ready_state is changed to Done and the status code is set to Unsent.
Trait Implementations
impl Clone for XmlHttpRequest
[src]
impl Clone for XmlHttpRequest
fn clone(&self) -> XmlHttpRequest
[src]
fn clone(&self) -> XmlHttpRequest
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for XmlHttpRequest
[src]
impl Debug for XmlHttpRequest
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialEq for XmlHttpRequest
[src]
impl PartialEq for XmlHttpRequest
fn eq(&self, other: &XmlHttpRequest) -> bool
[src]
fn eq(&self, other: &XmlHttpRequest) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &XmlHttpRequest) -> bool
[src]
fn ne(&self, other: &XmlHttpRequest) -> bool
This method tests for !=
.
impl Eq for XmlHttpRequest
[src]
impl Eq for XmlHttpRequest
impl From<XmlHttpRequest> for EventTarget
[src]
impl From<XmlHttpRequest> for EventTarget
fn from(value: XmlHttpRequest) -> Self
[src]
fn from(value: XmlHttpRequest) -> Self
Performs the conversion.
impl TryFrom<EventTarget> for XmlHttpRequest
[src]
impl TryFrom<EventTarget> for XmlHttpRequest
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: EventTarget) -> Result<Self, Self::Error>
[src]
fn try_from(value: EventTarget) -> Result<Self, Self::Error>
Performs the conversion.
impl InstanceOf for XmlHttpRequest
[src]
impl InstanceOf for XmlHttpRequest
fn instance_of(reference: &Reference) -> bool
[src]
fn instance_of(reference: &Reference) -> bool
Checks whenever a given Reference if of type Self
.
impl AsRef<Reference> for XmlHttpRequest
[src]
impl AsRef<Reference> for XmlHttpRequest
impl ReferenceType for XmlHttpRequest
[src]
impl ReferenceType for XmlHttpRequest
unsafe fn from_reference_unchecked(reference: Reference) -> Self
[src]
unsafe fn from_reference_unchecked(reference: Reference) -> Self
Converts a given reference into a concrete reference-like wrapper. Doesn't do any type checking; highly unsafe to use! Read more
impl From<XmlHttpRequest> for Reference
[src]
impl From<XmlHttpRequest> for Reference
fn from(value: XmlHttpRequest) -> Self
[src]
fn from(value: XmlHttpRequest) -> Self
Performs the conversion.
impl TryFrom<XmlHttpRequest> for Reference
[src]
impl TryFrom<XmlHttpRequest> for Reference
type Error = Void
The type returned in the event of a conversion error.
fn try_from(value: XmlHttpRequest) -> Result<Self, Self::Error>
[src]
fn try_from(value: XmlHttpRequest) -> Result<Self, Self::Error>
Performs the conversion.
impl TryFrom<Reference> for XmlHttpRequest
[src]
impl TryFrom<Reference> for XmlHttpRequest
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(reference: Reference) -> Result<Self, Self::Error>
[src]
fn try_from(reference: Reference) -> Result<Self, Self::Error>
Performs the conversion.
impl<'_r> TryFrom<&'_r Reference> for XmlHttpRequest
[src]
impl<'_r> TryFrom<&'_r Reference> for XmlHttpRequest
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(reference: &Reference) -> Result<Self, Self::Error>
[src]
fn try_from(reference: &Reference) -> Result<Self, Self::Error>
Performs the conversion.
impl TryFrom<Value> for XmlHttpRequest
[src]
impl TryFrom<Value> for XmlHttpRequest
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: Value) -> Result<Self, Self::Error>
[src]
fn try_from(value: Value) -> Result<Self, Self::Error>
Performs the conversion.
impl<'_r> TryFrom<&'_r Value> for XmlHttpRequest
[src]
impl<'_r> TryFrom<&'_r Value> for XmlHttpRequest
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: &Value) -> Result<Self, Self::Error>
[src]
fn try_from(value: &Value) -> Result<Self, Self::Error>
Performs the conversion.
impl JsSerialize for XmlHttpRequest
[src]
impl JsSerialize for XmlHttpRequest
impl IEventTarget for XmlHttpRequest
[src]
impl IEventTarget for XmlHttpRequest
fn add_event_listener<T, F>(&self, listener: F) -> EventListenerHandle where
T: ConcreteEvent,
F: FnMut(T) + 'static,
[src]
fn add_event_listener<T, F>(&self, listener: F) -> EventListenerHandle where
T: ConcreteEvent,
F: FnMut(T) + 'static,
Adds given event handler to the list of event listeners for the specified EventTarget
on which it's called. Read more
fn dispatch_event<T: IEvent>(&self, event: &T) -> Result<bool, TODO>
[src]
fn dispatch_event<T: IEvent>(&self, event: &T) -> Result<bool, TODO>
Dispatches an Event
at this EventTarget
, invoking the affected event listeners in the appropriate order. Read more
Auto Trait Implementations
impl Send for XmlHttpRequest
impl Send for XmlHttpRequest
impl Sync for XmlHttpRequest
impl Sync for XmlHttpRequest