[−][src]Struct rusty_v8::PropertyCallbackArguments
Methods
impl<'s> PropertyCallbackArguments<'s>[src]
pub fn this(&self) -> Local<Object>[src]
Returns the receiver. In many cases, this is the object on which the
property access was intercepted. When using
Reflect.get, Function.prototype.call, or similar functions, it is the
object passed in as receiver or thisArg.
void GetterCallback(Local<Name> name,
const v8::PropertyCallbackInfo<v8::Value>& info) {
auto context = info.GetIsolate()->GetCurrentContext();
v8::Local<v8::Value> a_this =
info.This()
->GetRealNamedProperty(context, v8_str("a"))
.ToLocalChecked();
v8::Local<v8::Value> a_holder =
info.Holder()
->GetRealNamedProperty(context, v8_str("a"))
.ToLocalChecked();
CHECK(v8_str("r")->Equals(context, a_this).FromJust());
CHECK(v8_str("obj")->Equals(context, a_holder).FromJust());
info.GetReturnValue().Set(name);
}
v8::Local<v8::FunctionTemplate> templ =
v8::FunctionTemplate::New(isolate);
templ->InstanceTemplate()->SetHandler(
v8::NamedPropertyHandlerConfiguration(GetterCallback));
LocalContext env;
env->Global()
->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local())
.ToLocalChecked()
->NewInstance(env.local())
.ToLocalChecked())
.FromJust();
CompileRun("obj.a = 'obj'; var r = {a: 'r'}; Reflect.get(obj, 'x', r)");
Auto Trait Implementations
impl<'s> RefUnwindSafe for PropertyCallbackArguments<'s>
impl<'s> !Send for PropertyCallbackArguments<'s>
impl<'s> !Sync for PropertyCallbackArguments<'s>
impl<'s> Unpin for PropertyCallbackArguments<'s>
impl<'s> UnwindSafe for PropertyCallbackArguments<'s>
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,
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.
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>,