pub struct JsProxyBuilder { /* private fields */ }Expand description
Implementations§
Source§impl JsProxyBuilder
impl JsProxyBuilder
Sourcepub fn new(target: JsObject) -> JsProxyBuilder
pub fn new(target: JsObject) -> JsProxyBuilder
Create a new ProxyBuilder with every trap set to undefined.
Sourcepub fn apply(
self,
apply: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>,
) -> JsProxyBuilder
pub fn apply( self, apply: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>, ) -> JsProxyBuilder
Set the apply proxy trap to the specified native function.
More information:
§Note
If the target object is not a function, then apply will be ignored
when trying to call the proxy, which will throw a type error.
Sourcepub fn construct(
self,
construct: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>,
) -> JsProxyBuilder
pub fn construct( self, construct: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>, ) -> JsProxyBuilder
Set the construct proxy trap to the specified native function.
More information:
§Note
If the target object is not a constructor, then construct will be ignored
when trying to construct an object using the proxy, which will throw a type error.
Sourcepub fn define_property(
self,
define_property: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>,
) -> JsProxyBuilder
pub fn define_property( self, define_property: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>, ) -> JsProxyBuilder
Set the defineProperty proxy trap to the specified native function.
More information:
Sourcepub fn delete_property(
self,
delete_property: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>,
) -> JsProxyBuilder
pub fn delete_property( self, delete_property: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>, ) -> JsProxyBuilder
Set the deleteProperty proxy trap to the specified native function.
More information:
Sourcepub fn get(
self,
get: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>,
) -> JsProxyBuilder
pub fn get( self, get: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>, ) -> JsProxyBuilder
Sourcepub fn get_own_property_descriptor(
self,
get_own_property_descriptor: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>,
) -> JsProxyBuilder
pub fn get_own_property_descriptor( self, get_own_property_descriptor: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>, ) -> JsProxyBuilder
Set the getOwnPropertyDescriptor proxy trap to the specified native function.
More information:
Sourcepub fn get_prototype_of(
self,
get_prototype_of: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>,
) -> JsProxyBuilder
pub fn get_prototype_of( self, get_prototype_of: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>, ) -> JsProxyBuilder
Set the getPrototypeOf proxy trap to the specified native function.
More information:
Sourcepub fn has(
self,
has: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>,
) -> JsProxyBuilder
pub fn has( self, has: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>, ) -> JsProxyBuilder
Sourcepub fn is_extensible(
self,
is_extensible: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>,
) -> JsProxyBuilder
pub fn is_extensible( self, is_extensible: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>, ) -> JsProxyBuilder
Set the isExtensible proxy trap to the specified native function.
More information:
Sourcepub fn own_keys(
self,
own_keys: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>,
) -> JsProxyBuilder
pub fn own_keys( self, own_keys: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>, ) -> JsProxyBuilder
Sourcepub fn prevent_extensions(
self,
prevent_extensions: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>,
) -> JsProxyBuilder
pub fn prevent_extensions( self, prevent_extensions: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>, ) -> JsProxyBuilder
Set the preventExtensions proxy trap to the specified native function.
More information:
Sourcepub fn set(
self,
set: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>,
) -> JsProxyBuilder
pub fn set( self, set: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>, ) -> JsProxyBuilder
Sourcepub fn set_prototype_of(
self,
set_prototype_of: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>,
) -> JsProxyBuilder
pub fn set_prototype_of( self, set_prototype_of: fn(&JsValue, &[JsValue], &mut Context) -> Result<JsValue, JsError>, ) -> JsProxyBuilder
Set the setPrototypeOf proxy trap to the specified native function.
More information:
Sourcepub fn build_revocable(self, context: &mut Context) -> JsRevocableProxy
pub fn build_revocable(self, context: &mut Context) -> JsRevocableProxy
Builds a JsObject of kind Proxy and a JsFunction that, when
called, disables the proxy of the object.
Equivalent to the Proxy.revocable ( target, handler ) static method,
but returns a JsObject for the proxy and a JsFunction for the
revoker in case there’s a need to manipulate the returned objects
inside Rust code.
Trait Implementations§
Source§impl Clone for JsProxyBuilder
impl Clone for JsProxyBuilder
Source§fn clone(&self) -> JsProxyBuilder
fn clone(&self) -> JsProxyBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for JsProxyBuilder
impl !RefUnwindSafe for JsProxyBuilder
impl !Send for JsProxyBuilder
impl !Sync for JsProxyBuilder
impl Unpin for JsProxyBuilder
impl !UnwindSafe for JsProxyBuilder
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.