Struct js_sys::Object [−][src]
#[repr(transparent)]pub struct Object { /* fields omitted */ }
Implementations
impl Object[src]
impl Object[src]impl Object[src]
impl Object[src]impl Object[src]
impl Object[src]impl Object[src]
impl Object[src]pub fn constructor(&self) -> Function[src]
The constructor property returns a reference to the Object constructor
function that created the instance object.
impl Object[src]
impl Object[src]impl Object[src]
impl Object[src]impl Object[src]
impl Object[src]pub fn define_properties(obj: &Object, props: &Object) -> Object[src]
The Object.defineProperties() method defines new or modifies
existing properties directly on an object, returning the
object.
impl Object[src]
impl Object[src]pub fn entries(object: &Object) -> Array[src]
The Object.entries() method returns an array of a given
object’s own enumerable property [key, value] pairs, in the
same order as that provided by a for…in loop (the difference
being that a for-in loop enumerates properties in the
prototype chain as well).
impl Object[src]
impl Object[src]pub fn freeze(value: &Object) -> Object[src]
The Object.freeze() method freezes an object: that is, prevents new
properties from being added to it; prevents existing properties from
being removed; and prevents existing properties, or their enumerability,
configurability, or writability, from being changed, it also prevents
the prototype from being changed. The method returns the passed object.
impl Object[src]
impl Object[src]impl Object[src]
impl Object[src]pub fn get_own_property_descriptor(obj: &Object, prop: &JsValue) -> JsValue[src]
The Object.getOwnPropertyDescriptor() method returns a
property descriptor for an own property (that is, one directly
present on an object and not in the object’s prototype chain)
of a given object.
impl Object[src]
impl Object[src]pub fn get_own_property_descriptors(obj: &Object) -> JsValue[src]
The Object.getOwnPropertyDescriptors() method returns all own
property descriptors of a given object.
impl Object[src]
impl Object[src]pub fn get_own_property_names(obj: &Object) -> Array[src]
The Object.getOwnPropertyNames() method returns an array of
all properties (including non-enumerable properties except for
those which use Symbol) found directly upon a given object.
impl Object[src]
impl Object[src]pub fn get_own_property_symbols(obj: &Object) -> Array[src]
The Object.getOwnPropertySymbols() method returns an array of
all symbol properties found directly upon a given object.
impl Object[src]
impl Object[src]pub fn get_prototype_of(obj: &JsValue) -> Object[src]
The Object.getPrototypeOf() method returns the prototype
(i.e. the value of the internal [[Prototype]] property) of the
specified object.
impl Object[src]
impl Object[src]pub fn has_own_property(&self, property: &JsValue) -> bool[src]
The hasOwnProperty() method returns a boolean indicating whether the
object has the specified property as its own property (as opposed to
inheriting it).
impl Object[src]
impl Object[src]impl Object[src]
impl Object[src]pub fn is_extensible(object: &Object) -> bool[src]
The Object.isExtensible() method determines if an object is extensible
(whether it can have new properties added to it).
impl Object[src]
impl Object[src]impl Object[src]
impl Object[src]impl Object[src]
impl Object[src]pub fn is_prototype_of(&self, value: &JsValue) -> bool[src]
The isPrototypeOf() method checks if an object exists in another
object’s prototype chain.
impl Object[src]
impl Object[src]impl Object[src]
impl Object[src]pub fn prevent_extensions(object: &Object)[src]
The Object.preventExtensions() method prevents new properties from
ever being added to an object (i.e. prevents future extensions to the
object).
impl Object[src]
impl Object[src]pub fn property_is_enumerable(&self, property: &JsValue) -> bool[src]
The propertyIsEnumerable() method returns a Boolean indicating
whether the specified property is enumerable.
impl Object[src]
impl Object[src]impl Object[src]
impl Object[src]pub fn set_prototype_of(object: &Object, prototype: &Object) -> Object[src]
The Object.setPrototypeOf() method sets the prototype (i.e., the
internal [[Prototype]] property) of a specified object to another
object or null.
impl Object[src]
impl Object[src]pub fn to_locale_string(&self) -> JsString[src]
The toLocaleString() method returns a string representing the object.
This method is meant to be overridden by derived objects for
locale-specific purposes.
impl Object[src]
impl Object[src]impl Object[src]
impl Object[src]impl Object[src]
impl Object[src]impl Object[src]
impl Object[src]Methods from Deref<Target = JsValue>
pub const NULL: JsValue[src]
pub const UNDEFINED: JsValue[src]
pub const TRUE: JsValue[src]
pub const FALSE: JsValue[src]
pub fn as_f64(&self) -> Option<f64>[src]
Returns the f64 value of this JS value if it’s an instance of a
number.
If this JS value is not an instance of a number then this returns
None.
pub fn is_string(&self) -> bool[src]
Tests whether this JS value is a JS string.
pub fn as_string(&self) -> Option<String>[src]
If this JS value is a string value, this function copies the JS string
value into wasm linear memory, encoded as UTF-8, and returns it as a
Rust String.
To avoid the copying and re-encoding, consider the
JsString::try_from() function from js-sys
instead.
If this JS value is not an instance of a string or if it’s not valid
utf-8 then this returns None.
UTF-16 vs UTF-8
JavaScript strings in general are encoded as UTF-16, but Rust strings
are encoded as UTF-8. This can cause the Rust string to look a bit
different than the JS string sometimes. For more details see the
documentation about the str type which contains a few
caveats about the encodings.
pub fn as_bool(&self) -> Option<bool>[src]
Returns the bool value of this JS value if it’s an instance of a
boolean.
If this JS value is not an instance of a boolean then this returns
None.
pub fn is_null(&self) -> bool[src]
Tests whether this JS value is null
pub fn is_undefined(&self) -> bool[src]
Tests whether this JS value is undefined
pub fn is_symbol(&self) -> bool[src]
Tests whether the type of this JS value is symbol
pub fn is_object(&self) -> bool[src]
Tests whether typeof self == "object" && self !== null.
pub fn is_function(&self) -> bool[src]
Tests whether the type of this JS value is function.
pub fn is_truthy(&self) -> bool[src]
Tests whether the value is “truthy”.
pub fn is_falsy(&self) -> bool[src]
Tests whether the value is “falsy”.
Trait Implementations
impl From<ArrayBuffer> for Object[src]
impl From<ArrayBuffer> for Object[src]fn from(obj: ArrayBuffer) -> Object[src]
impl From<DateTimeFormat> for Object[src]
impl From<DateTimeFormat> for Object[src]fn from(obj: DateTimeFormat) -> Object[src]
impl From<Float32Array> for Object[src]
impl From<Float32Array> for Object[src]fn from(obj: Float32Array) -> Object[src]
impl From<Float64Array> for Object[src]
impl From<Float64Array> for Object[src]fn from(obj: Float64Array) -> Object[src]
impl From<Int16Array> for Object[src]
impl From<Int16Array> for Object[src]fn from(obj: Int16Array) -> Object[src]
impl From<Int32Array> for Object[src]
impl From<Int32Array> for Object[src]fn from(obj: Int32Array) -> Object[src]
impl From<IteratorNext> for Object[src]
impl From<IteratorNext> for Object[src]fn from(obj: IteratorNext) -> Object[src]
impl From<NumberFormat> for Object[src]
impl From<NumberFormat> for Object[src]fn from(obj: NumberFormat) -> Object[src]
impl From<PluralRules> for Object[src]
impl From<PluralRules> for Object[src]fn from(obj: PluralRules) -> Object[src]
impl From<RangeError> for Object[src]
impl From<RangeError> for Object[src]fn from(obj: RangeError) -> Object[src]
impl From<ReferenceError> for Object[src]
impl From<ReferenceError> for Object[src]fn from(obj: ReferenceError) -> Object[src]
impl From<SharedArrayBuffer> for Object[src]
impl From<SharedArrayBuffer> for Object[src]fn from(obj: SharedArrayBuffer) -> Object[src]
impl From<SyntaxError> for Object[src]
impl From<SyntaxError> for Object[src]fn from(obj: SyntaxError) -> Object[src]
impl From<Uint16Array> for Object[src]
impl From<Uint16Array> for Object[src]fn from(obj: Uint16Array) -> Object[src]
impl From<Uint32Array> for Object[src]
impl From<Uint32Array> for Object[src]fn from(obj: Uint32Array) -> Object[src]
impl From<Uint8Array> for Object[src]
impl From<Uint8Array> for Object[src]fn from(obj: Uint8Array) -> Object[src]
impl From<Uint8ClampedArray> for Object[src]
impl From<Uint8ClampedArray> for Object[src]fn from(obj: Uint8ClampedArray) -> Object[src]
impl FromWasmAbi for Object[src]
impl FromWasmAbi for Object[src]impl IntoWasmAbi for Object[src]
impl IntoWasmAbi for Object[src]impl<'a> IntoWasmAbi for &'a Object[src]
impl<'a> IntoWasmAbi for &'a Object[src]impl JsCast for Object[src]
impl JsCast for Object[src]fn instanceof(val: &JsValue) -> bool[src]
fn unchecked_from_js(val: JsValue) -> Self[src]
fn unchecked_from_js_ref(val: &JsValue) -> &Self[src]
pub fn has_type<T>(&self) -> bool where
T: JsCast, [src]
T: JsCast,
pub fn dyn_into<T>(self) -> Result<T, Self> where
T: JsCast, [src]
T: JsCast,
pub fn dyn_ref<T>(&self) -> Option<&T> where
T: JsCast, [src]
T: JsCast,
pub fn unchecked_into<T>(self) -> T where
T: JsCast, [src]
T: JsCast,
pub fn unchecked_ref<T>(&self) -> &T where
T: JsCast, [src]
T: JsCast,
pub fn is_instance_of<T>(&self) -> bool where
T: JsCast, [src]
T: JsCast,
pub fn is_type_of(val: &JsValue) -> bool[src]
impl RefFromWasmAbi for Object[src]
impl RefFromWasmAbi for Object[src]type Abi = <JsValue as RefFromWasmAbi>::Abi
The wasm ABI type references to Self are recovered from.
type Anchor = ManuallyDrop<Object>
The type that holds the reference to Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous. Read more
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor[src]
impl Eq for Object[src]
Auto Trait Implementations
impl RefUnwindSafe for Object
impl !Send for Object
impl !Sync for Object
impl Unpin for Object
impl UnwindSafe for Object
Blanket Implementations
impl<T> ReturnWasmAbi for T where
T: IntoWasmAbi, [src]
impl<T> ReturnWasmAbi for T where
T: IntoWasmAbi, [src]type Abi = <T as IntoWasmAbi>::Abi
Same as IntoWasmAbi::Abi