pub struct BindOptions<'a, 'cx: 'a> { /* private fields */ }
Expand description
A builder for making a JavaScript function call like parseInt("42")
.
The builder methods make it convenient to assemble the call from parts:
let x: f64 = parse_int
.bind(&mut cx)
.arg("42")?
.call()?;
Implementations§
Source§impl<'a, 'cx: 'a> BindOptions<'a, 'cx>
impl<'a, 'cx: 'a> BindOptions<'a, 'cx>
Sourcepub fn this<T: TryIntoJs<'cx>>(&mut self, this: T) -> NeonResult<&mut Self>
pub fn this<T: TryIntoJs<'cx>>(&mut self, this: T) -> NeonResult<&mut Self>
Set the value of this
for the function call.
Sourcepub fn args<A: TryIntoArguments<'cx>>(&mut self, a: A) -> NeonResult<&mut Self>
pub fn args<A: TryIntoArguments<'cx>>(&mut self, a: A) -> NeonResult<&mut Self>
Replaces the arguments list with the given arguments.
Sourcepub fn args_with<R, F>(&mut self, f: F) -> NeonResult<&mut Self>
pub fn args_with<R, F>(&mut self, f: F) -> NeonResult<&mut Self>
Replaces the arguments list with a list computed from a closure.
Sourcepub fn arg<A: TryIntoJs<'cx>>(&mut self, a: A) -> NeonResult<&mut Self>
pub fn arg<A: TryIntoJs<'cx>>(&mut self, a: A) -> NeonResult<&mut Self>
Add an argument to the arguments list.
Sourcepub fn arg_with<R, F>(&mut self, f: F) -> NeonResult<&mut Self>
pub fn arg_with<R, F>(&mut self, f: F) -> NeonResult<&mut Self>
Add an argument to the arguments list, computed from a closure.
Sourcepub fn call<R: TryFromJs<'cx>>(&mut self) -> NeonResult<R>
pub fn call<R: TryFromJs<'cx>>(&mut self) -> NeonResult<R>
Make the function call. If the function returns without throwing, the result value
is converted to a Rust value with TryFromJs::from_js
.
Sourcepub fn construct<R: TryFromJs<'cx>>(&mut self) -> NeonResult<R>
pub fn construct<R: TryFromJs<'cx>>(&mut self) -> NeonResult<R>
Make the function call as a constructor. If the function returns without throwing, the
result value is converted to a Rust value with TryFromJs::from_js
.
Sourcepub fn exec(&mut self) -> NeonResult<()>
pub fn exec(&mut self) -> NeonResult<()>
Make the function call for side effect, discarding the result value. This method is
preferable to call()
when the result value isn’t needed,
since it doesn’t require specifying a result type.
Auto Trait Implementations§
impl<'a, 'cx> Freeze for BindOptions<'a, 'cx>
impl<'a, 'cx> RefUnwindSafe for BindOptions<'a, 'cx>
impl<'a, 'cx> !Send for BindOptions<'a, 'cx>
impl<'a, 'cx> !Sync for BindOptions<'a, 'cx>
impl<'a, 'cx> Unpin for BindOptions<'a, 'cx>
impl<'a, 'cx> !UnwindSafe for BindOptions<'a, 'cx>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more