Struct rora_javascript_adapter::JsRequest
source · [−]pub struct JsRequest {
pub uri: String,
pub method: String,
pub body: Option<String>,
pub headers: HashMap<String, String>,
}
Expand description
Represents a request originating from JavaScript.
// JavaScript Example
import {JsRequest} from "my-wasm-app"
const jsRequest = new JsRequest("https://www.rust-lang.org/", "GET");
jsRequest.headers_append("Content-Type", "text/html");
// pass request to WASM app
Consume the request in Rust
use javascript_adapter::JsRequest;
#[wasm_bindgen]
pub fn app(js_request: JsRequest) {
// do things with js_request
}
Fields
uri: String
method: String
body: Option<String>
headers: HashMap<String, String>
Implementations
Trait Implementations
sourceimpl FromWasmAbi for JsRequest
impl FromWasmAbi for JsRequest
sourceimpl IntoWasmAbi for JsRequest
impl IntoWasmAbi for JsRequest
sourceimpl OptionFromWasmAbi for JsRequest
impl OptionFromWasmAbi for JsRequest
sourceimpl OptionIntoWasmAbi for JsRequest
impl OptionIntoWasmAbi for JsRequest
sourceimpl RefFromWasmAbi for JsRequest
impl RefFromWasmAbi for JsRequest
type Anchor = Ref<'static, JsRequest>
type Anchor = Ref<'static, JsRequest>
The type that holds the reference to Self
for the duration of the
invocation of the function that has an &Self
parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous. Read more
sourceunsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
Recover a Self::Anchor
from Self::Abi
. Read more
sourceimpl RefMutFromWasmAbi for JsRequest
impl RefMutFromWasmAbi for JsRequest
Auto Trait Implementations
impl RefUnwindSafe for JsRequest
impl Send for JsRequest
impl Sync for JsRequest
impl Unpin for JsRequest
impl UnwindSafe for JsRequest
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> ReturnWasmAbi for T where
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for T where
T: IntoWasmAbi,
type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as IntoWasmAbi::Abi
sourcefn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
. Read more