[−][src]Struct neon::context::CallContext
A view of the JS engine in the context of a function call.
The type parameter T
is the type of the this
-binding.
Implementations
impl<'a, T: This> CallContext<'a, T>
[src]
pub fn kind(&self) -> CallKind
[src]
Indicates whether the function was called via the JavaScript [[Call]]
or [[Construct]]
semantics.
pub fn len(&self) -> i32
[src]
Indicates the number of arguments that were passed to the function.
pub fn argument_opt(&mut self, i: i32) -> Option<Handle<'a, JsValue>>
[src]
Produces the i
th argument, or None
if i
is greater than or equal to self.len()
.
pub fn argument<V: Value>(&mut self, i: i32) -> JsResult<'a, V>
[src]
Produces the i
th argument and casts it to the type V
, or throws an exception if i
is greater than or equal to self.len()
or cannot be cast to V
.
pub fn this(&mut self) -> Handle<'a, T>
[src]
Produces a handle to the this
-binding.
Trait Implementations
impl<'a, T: This> Context<'a> for CallContext<'a, T>
[src]
pub fn lock(&self) -> Lock<'_>
[src]
pub fn borrow<'c, V, T, F>(&self, v: &'c Handle<'_, V>, f: F) -> T where
V: Value,
&'c V: Borrow,
F: for<'b> FnOnce(Ref<'b, <&'c V as Borrow>::Target>) -> T,
[src]
V: Value,
&'c V: Borrow,
F: for<'b> FnOnce(Ref<'b, <&'c V as Borrow>::Target>) -> T,
pub fn borrow_mut<'c, V, T, F>(&self, v: &'c mut Handle<'_, V>, f: F) -> T where
V: Value,
&'c mut V: BorrowMut,
F: for<'b> FnOnce(RefMut<'b, <&'c mut V as Borrow>::Target>) -> T,
[src]
V: Value,
&'c mut V: BorrowMut,
F: for<'b> FnOnce(RefMut<'b, <&'c mut V as Borrow>::Target>) -> T,
pub fn execute_scoped<T, F>(&self, f: F) -> T where
F: for<'b> FnOnce(ExecuteContext<'b>) -> T,
[src]
F: for<'b> FnOnce(ExecuteContext<'b>) -> T,
pub fn compute_scoped<V, F>(&self, f: F) -> JsResult<'a, V> where
V: Value,
F: for<'b, 'c> FnOnce(ComputeContext<'b, 'c>) -> JsResult<'b, V>,
[src]
V: Value,
F: for<'b, 'c> FnOnce(ComputeContext<'b, 'c>) -> JsResult<'b, V>,
pub fn try_catch<'b: 'a, T, F>(
&mut self,
f: F
) -> Result<T, Handle<'a, JsValue>> where
F: FnOnce(&mut Self) -> NeonResult<T>,
[src]
&mut self,
f: F
) -> Result<T, Handle<'a, JsValue>> where
F: FnOnce(&mut Self) -> NeonResult<T>,
pub fn boolean(&mut self, b: bool) -> Handle<'a, JsBoolean>
[src]
pub fn number<T: Into<f64>>(&mut self, x: T) -> Handle<'a, JsNumber>
[src]
pub fn string<S: AsRef<str>>(&mut self, s: S) -> Handle<'a, JsString>
[src]
pub fn try_string<S: AsRef<str>>(&mut self, s: S) -> StringResult<'a>
[src]
pub fn null(&mut self) -> Handle<'a, JsNull>
[src]
pub fn undefined(&mut self) -> Handle<'a, JsUndefined>
[src]
pub fn empty_object(&mut self) -> Handle<'a, JsObject>
[src]
pub fn empty_array(&mut self) -> Handle<'a, JsArray>
[src]
pub fn array_buffer(&mut self, size: u32) -> JsResult<'a, JsArrayBuffer>
[src]
pub fn buffer(&mut self, size: u32) -> JsResult<'a, JsBuffer>
[src]
pub fn global(&mut self) -> Handle<'a, JsObject>
[src]
pub fn throw<'b, T: Value, U>(&mut self, v: Handle<'b, T>) -> NeonResult<U>
[src]
pub fn error<S: AsRef<str>>(&mut self, msg: S) -> JsResult<'a, JsError>
[src]
pub fn type_error<S: AsRef<str>>(&mut self, msg: S) -> JsResult<'a, JsError>
[src]
pub fn range_error<S: AsRef<str>>(&mut self, msg: S) -> JsResult<'a, JsError>
[src]
pub fn throw_error<S: AsRef<str>, T>(&mut self, msg: S) -> NeonResult<T>
[src]
pub fn throw_type_error<S: AsRef<str>, T>(&mut self, msg: S) -> NeonResult<T>
[src]
pub fn throw_range_error<S: AsRef<str>, T>(&mut self, msg: S) -> NeonResult<T>
[src]
pub fn boxed<U: Finalize + Send + 'static>(
&mut self,
v: U
) -> Handle<'a, JsBox<U>>
[src]
&mut self,
v: U
) -> Handle<'a, JsBox<U>>
impl<'a, T: This> UnwindSafe for CallContext<'a, T>
[src]
Auto Trait Implementations
impl<'a, T> !RefUnwindSafe for CallContext<'a, T>
impl<'a, T> !Send for CallContext<'a, T>
impl<'a, T> !Sync for CallContext<'a, T>
impl<'a, T> Unpin for CallContext<'a, T> where
T: Unpin,
T: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,