Struct v8::ObjectTemplate
source · #[repr(C)]pub struct ObjectTemplate(_);
Expand description
An ObjectTemplate is used to create objects at runtime.
Properties added to an ObjectTemplate are added to each object created from the ObjectTemplate.
Implementations§
source§impl ObjectTemplate
impl ObjectTemplate
sourcepub fn new<'s>(scope: &mut HandleScope<'s, ()>) -> Local<'s, ObjectTemplate>
pub fn new<'s>(scope: &mut HandleScope<'s, ()>) -> Local<'s, ObjectTemplate>
Creates an object template.
sourcepub fn new_from_template<'s>(
scope: &mut HandleScope<'s, ()>,
templ: Local<'_, FunctionTemplate>
) -> Local<'s, ObjectTemplate>
pub fn new_from_template<'s>(
scope: &mut HandleScope<'s, ()>,
templ: Local<'_, FunctionTemplate>
) -> Local<'s, ObjectTemplate>
Creates an object template from a function template.
sourcepub fn new_instance<'s>(
&self,
scope: &mut HandleScope<'s>
) -> Option<Local<'s, Object>>
pub fn new_instance<'s>(
&self,
scope: &mut HandleScope<'s>
) -> Option<Local<'s, Object>>
Creates a new instance of this object template.
sourcepub fn internal_field_count(&self) -> usize
pub fn internal_field_count(&self) -> usize
Gets the number of internal fields for objects generated from this template.
sourcepub fn set_internal_field_count(&self, value: usize) -> bool
pub fn set_internal_field_count(&self, value: usize) -> bool
Sets the number of internal fields for objects generated from this template.
pub fn set_accessor(
&self,
key: Local<'_, Name>,
getter: impl for<'s> MapFnTo<AccessorNameGetterCallback<'s>>
)
pub fn set_accessor_with_setter(
&self,
key: Local<'_, Name>,
getter: impl for<'s> MapFnTo<AccessorNameGetterCallback<'s>>,
setter: impl for<'s> MapFnTo<AccessorNameSetterCallback<'s>>
)
pub fn set_named_property_handler(
&self,
configuration: NamedPropertyHandlerConfiguration<'_>
)
pub fn set_indexed_property_handler(
&self,
configuration: IndexedPropertyHandlerConfiguration<'_>
)
sourcepub fn set_accessor_property(
&self,
key: Local<'_, Name>,
getter: Option<Local<'_, FunctionTemplate>>,
setter: Option<Local<'_, FunctionTemplate>>,
attr: PropertyAttribute
)
pub fn set_accessor_property(
&self,
key: Local<'_, Name>,
getter: Option<Local<'_, FunctionTemplate>>,
setter: Option<Local<'_, FunctionTemplate>>,
attr: PropertyAttribute
)
sourcepub fn set_immutable_proto(&self)
pub fn set_immutable_proto(&self)
Makes the ObjectTemplate for an immutable prototype exotic object, with an immutable proto.
Methods from Deref<Target = Template>§
sourcepub fn set(&self, key: Local<'_, Name>, value: Local<'_, Data>)
pub fn set(&self, key: Local<'_, Name>, value: Local<'_, Data>)
Adds a property to each instance created by this template.
sourcepub fn set_with_attr(
&self,
key: Local<'_, Name>,
value: Local<'_, Data>,
attr: PropertyAttribute
)
pub fn set_with_attr(
&self,
key: Local<'_, Name>,
value: Local<'_, Data>,
attr: PropertyAttribute
)
Adds a property to each instance created by this template with the specified property attributes.
Methods from Deref<Target = Data>§
sourcepub fn is_big_int(&self) -> bool
pub fn is_big_int(&self) -> bool
Returns true if this data is a BigInt
.
sourcepub fn is_boolean(&self) -> bool
pub fn is_boolean(&self) -> bool
Returns true if this data is a Boolean
.
sourcepub fn is_context(&self) -> bool
pub fn is_context(&self) -> bool
Returns true if this data is a Context
.
sourcepub fn is_fixed_array(&self) -> bool
pub fn is_fixed_array(&self) -> bool
Returns true if this data is a FixedArray
.
sourcepub fn is_function_template(&self) -> bool
pub fn is_function_template(&self) -> bool
Returns true if this data is a FunctionTemplate
.
sourcepub fn is_module_request(&self) -> bool
pub fn is_module_request(&self) -> bool
Returns true if this data is a ModuleRequest
.
sourcepub fn is_object_template(&self) -> bool
pub fn is_object_template(&self) -> bool
Returns true if this data is a ObjectTemplate
.
sourcepub fn is_primitive(&self) -> bool
pub fn is_primitive(&self) -> bool
Returns true if this data is a Primitive
.
sourcepub fn is_private(&self) -> bool
pub fn is_private(&self) -> bool
Returns true if this data is a Private
.
Trait Implementations§
source§impl Debug for ObjectTemplate
impl Debug for ObjectTemplate
source§impl Deref for ObjectTemplate
impl Deref for ObjectTemplate
source§impl<'s> PartialEq<Data> for ObjectTemplate
impl<'s> PartialEq<Data> for ObjectTemplate
source§impl<'s> PartialEq<ObjectTemplate> for Data
impl<'s> PartialEq<ObjectTemplate> for Data
source§fn eq(&self, other: &ObjectTemplate) -> bool
fn eq(&self, other: &ObjectTemplate) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<'s> PartialEq<ObjectTemplate> for ObjectTemplate
impl<'s> PartialEq<ObjectTemplate> for ObjectTemplate
source§fn eq(&self, other: &ObjectTemplate) -> bool
fn eq(&self, other: &ObjectTemplate) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<'s> PartialEq<ObjectTemplate> for Template
impl<'s> PartialEq<ObjectTemplate> for Template
source§fn eq(&self, other: &ObjectTemplate) -> bool
fn eq(&self, other: &ObjectTemplate) -> bool
self
and other
values to be equal, and is used
by ==
.