Struct quickjs_rusty::value::OwnedJsPromise  
source · pub struct OwnedJsPromise { /* private fields */ }Implementations§
source§impl OwnedJsPromise
 
impl OwnedJsPromise
pub fn try_from_value(value: OwnedJsValue) -> Result<Self, ValueError>
pub fn into_value(self) -> OwnedJsValue
pub fn state(&self) -> PromiseState
sourcepub fn result(&self) -> OwnedJsValue
 
pub fn result(&self) -> OwnedJsValue
Returns the result of the promise if the promise’s state is in the FULFILLED or REJECTED state, otherwise returns Undefined.
pub fn then( &self, on_fulfilled: &OwnedJsValue, ) -> Result<OwnedJsPromise, ExecutionError>
pub fn then2( &self, on_fulfilled: &OwnedJsValue, on_rejected: &OwnedJsValue, ) -> Result<OwnedJsPromise, ExecutionError>
pub fn catch( &self, on_rejected: &OwnedJsValue, ) -> Result<OwnedJsPromise, ExecutionError>
pub fn finally( &self, on_finally: &OwnedJsValue, ) -> Result<OwnedJsPromise, ExecutionError>
pub fn resolve( context: &Context, value: &OwnedJsValue, ) -> Result<OwnedJsPromise, ExecutionError>
pub fn reject( context: &Context, value: &OwnedJsValue, ) -> Result<OwnedJsPromise, ExecutionError>
pub fn all( context: &Context, values: impl IntoIterator<Item = OwnedJsPromise>, ) -> Result<OwnedJsPromise, ExecutionError>
pub fn all_settled( context: &Context, values: impl IntoIterator<Item = OwnedJsPromise>, ) -> Result<OwnedJsPromise, ExecutionError>
pub fn race( context: &Context, values: impl IntoIterator<Item = OwnedJsPromise>, ) -> Result<OwnedJsPromise, ExecutionError>
pub fn any( context: &Context, values: impl IntoIterator<Item = OwnedJsPromise>, ) -> Result<OwnedJsPromise, ExecutionError>
pub fn with_resolvers( context: &Context, ) -> Result<(OwnedJsPromise, JsFunction, JsFunction), ExecutionError>
Methods from Deref<Target = OwnedJsValue>§
pub fn context(&self) -> *mut JSContext
pub fn tag(&self) -> JsTag
sourcepub unsafe fn as_inner(&self) -> &JSValue
 
pub unsafe fn as_inner(&self) -> &JSValue
Get the inner JSValue without increasing ref count.
Unsafe because the caller must ensure proper memory management.
sourcepub fn is_undefined(&self) -> bool
 
pub fn is_undefined(&self) -> bool
Check if this value is undefined.
sourcepub fn is_exception(&self) -> bool
 
pub fn is_exception(&self) -> bool
Check if this value is a Javascript exception.
sourcepub fn is_function(&self) -> bool
 
pub fn is_function(&self) -> bool
Check if this value is a Javascript function.
sourcepub fn is_promise(&self) -> bool
 
pub fn is_promise(&self) -> bool
Check if this value is a Javascript promise.
sourcepub fn is_compiled_function(&self) -> bool
 
pub fn is_compiled_function(&self) -> bool
Check if this value is a bytecode compiled function.
sourcepub fn to_bool(&self) -> Result<bool, ValueError>
 
pub fn to_bool(&self) -> Result<bool, ValueError>
Convert this value into a bool
sourcepub fn to_int(&self) -> Result<i32, ValueError>
 
pub fn to_int(&self) -> Result<i32, ValueError>
Convert this value into an i32
sourcepub fn to_float(&self) -> Result<f64, ValueError>
 
pub fn to_float(&self) -> Result<f64, ValueError>
Convert this value into an f64
sourcepub fn to_string(&self) -> Result<String, ValueError>
 
pub fn to_string(&self) -> Result<String, ValueError>
Convert this value into a string
pub fn to_array(&self) -> Result<OwnedJsArray, ValueError>
pub fn to_date(&self) -> Result<DateTime<Utc>, ValueError>
pub fn to_bigint(&self) -> Result<BigInt, ValueError>
sourcepub fn js_to_string(&self) -> Result<String, ExecutionError>
 
pub fn js_to_string(&self) -> Result<String, ExecutionError>
Call the Javascript .toString() method on this value.
sourcepub fn to_json_string(&self, space: u8) -> Result<String, ExecutionError>
 
pub fn to_json_string(&self, space: u8) -> Result<String, ExecutionError>
Call the Javascript JSON.stringify() method on this value.
Trait Implementations§
source§impl Clone for OwnedJsPromise
 
impl Clone for OwnedJsPromise
source§fn clone(&self) -> OwnedJsPromise
 
fn clone(&self) -> OwnedJsPromise
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from 
source. Read moresource§impl Debug for OwnedJsPromise
 
impl Debug for OwnedJsPromise
source§impl Deref for OwnedJsPromise
 
impl Deref for OwnedJsPromise
source§impl PartialEq for OwnedJsPromise
 
impl PartialEq for OwnedJsPromise
source§fn eq(&self, other: &OwnedJsPromise) -> bool
 
fn eq(&self, other: &OwnedJsPromise) -> bool
This method tests for 
self and other values to be equal, and is used
by ==.source§impl ToOwnedJsValue for OwnedJsPromise
 
impl ToOwnedJsValue for OwnedJsPromise
source§impl TryFrom<OwnedJsValue> for OwnedJsPromise
 
impl TryFrom<OwnedJsValue> for OwnedJsPromise
§type Error = ValueError
 
type Error = ValueError
The type returned in the event of a conversion error.
impl StructuralPartialEq for OwnedJsPromise
Auto Trait Implementations§
impl Freeze for OwnedJsPromise
impl RefUnwindSafe for OwnedJsPromise
impl !Send for OwnedJsPromise
impl !Sync for OwnedJsPromise
impl Unpin for OwnedJsPromise
impl UnwindSafe for OwnedJsPromise
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