objc2_javascript_core/generated/
JSValueRef.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4#[cfg(feature = "objc2")]
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9/// A constant identifying the type of a JSValue.
10///
11/// See also [Apple's documentation](https://developer.apple.com/documentation/javascriptcore/jstype?language=objc)
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct JSType(pub c_uint);
15impl JSType {
16    #[doc(alias = "kJSTypeUndefined")]
17    pub const Undefined: Self = Self(0);
18    #[doc(alias = "kJSTypeNull")]
19    pub const Null: Self = Self(1);
20    #[doc(alias = "kJSTypeBoolean")]
21    pub const Boolean: Self = Self(2);
22    #[doc(alias = "kJSTypeNumber")]
23    pub const Number: Self = Self(3);
24    #[doc(alias = "kJSTypeString")]
25    pub const String: Self = Self(4);
26    #[doc(alias = "kJSTypeObject")]
27    pub const Object: Self = Self(5);
28    #[doc(alias = "kJSTypeSymbol")]
29    pub const Symbol: Self = Self(6);
30    #[doc(alias = "kJSTypeBigInt")]
31    pub const BigInt: Self = Self(7);
32}
33
34#[cfg(feature = "objc2")]
35unsafe impl Encode for JSType {
36    const ENCODING: Encoding = c_uint::ENCODING;
37}
38
39#[cfg(feature = "objc2")]
40unsafe impl RefEncode for JSType {
41    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
42}
43
44/// A constant identifying the Typed Array type of a JSObjectRef.
45///
46/// See also [Apple's documentation](https://developer.apple.com/documentation/javascriptcore/jstypedarraytype?language=objc)
47#[repr(transparent)]
48#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
49pub struct JSTypedArrayType(pub c_uint);
50impl JSTypedArrayType {
51    #[doc(alias = "kJSTypedArrayTypeInt8Array")]
52    pub const Int8Array: Self = Self(0);
53    #[doc(alias = "kJSTypedArrayTypeInt16Array")]
54    pub const Int16Array: Self = Self(1);
55    #[doc(alias = "kJSTypedArrayTypeInt32Array")]
56    pub const Int32Array: Self = Self(2);
57    #[doc(alias = "kJSTypedArrayTypeUint8Array")]
58    pub const Uint8Array: Self = Self(3);
59    #[doc(alias = "kJSTypedArrayTypeUint8ClampedArray")]
60    pub const Uint8ClampedArray: Self = Self(4);
61    #[doc(alias = "kJSTypedArrayTypeUint16Array")]
62    pub const Uint16Array: Self = Self(5);
63    #[doc(alias = "kJSTypedArrayTypeUint32Array")]
64    pub const Uint32Array: Self = Self(6);
65    #[doc(alias = "kJSTypedArrayTypeFloat32Array")]
66    pub const Float32Array: Self = Self(7);
67    #[doc(alias = "kJSTypedArrayTypeFloat64Array")]
68    pub const Float64Array: Self = Self(8);
69    #[doc(alias = "kJSTypedArrayTypeArrayBuffer")]
70    pub const ArrayBuffer: Self = Self(9);
71    #[doc(alias = "kJSTypedArrayTypeNone")]
72    pub const None: Self = Self(10);
73    #[doc(alias = "kJSTypedArrayTypeBigInt64Array")]
74    pub const BigInt64Array: Self = Self(11);
75    #[doc(alias = "kJSTypedArrayTypeBigUint64Array")]
76    pub const BigUint64Array: Self = Self(12);
77}
78
79#[cfg(feature = "objc2")]
80unsafe impl Encode for JSTypedArrayType {
81    const ENCODING: Encoding = c_uint::ENCODING;
82}
83
84#[cfg(feature = "objc2")]
85unsafe impl RefEncode for JSTypedArrayType {
86    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
87}
88
89/// A constant identifying the type of JavaScript relation condition.
90///
91/// See also [Apple's documentation](https://developer.apple.com/documentation/javascriptcore/jsrelationcondition?language=objc)
92// NS_ENUM
93#[repr(transparent)]
94#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
95pub struct JSRelationCondition(pub u32);
96impl JSRelationCondition {
97    /// A constant identifying the type of JavaScript relation condition.
98    #[doc(alias = "kJSRelationConditionUndefined")]
99    pub const Undefined: Self = Self(0);
100    /// A constant identifying the type of JavaScript relation condition.
101    #[doc(alias = "kJSRelationConditionEqual")]
102    pub const Equal: Self = Self(1);
103    /// A constant identifying the type of JavaScript relation condition.
104    #[doc(alias = "kJSRelationConditionGreaterThan")]
105    pub const GreaterThan: Self = Self(2);
106    /// A constant identifying the type of JavaScript relation condition.
107    #[doc(alias = "kJSRelationConditionLessThan")]
108    pub const LessThan: Self = Self(3);
109}
110
111#[cfg(feature = "objc2")]
112unsafe impl Encode for JSRelationCondition {
113    const ENCODING: Encoding = u32::ENCODING;
114}
115
116#[cfg(feature = "objc2")]
117unsafe impl RefEncode for JSRelationCondition {
118    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
119}
120
121#[cfg(all(feature = "JSValue", feature = "objc2"))]
122impl JSValue {
123    /// Returns a JavaScript value's type.
124    ///
125    /// Parameter `ctx`: The execution context to use.
126    ///
127    /// Parameter `value`: The JSValue whose type you want to obtain.
128    ///
129    /// Returns: A value of type JSType that identifies value's type.
130    #[doc(alias = "JSValueGetType")]
131    #[cfg(feature = "JSBase")]
132    #[inline]
133    pub unsafe fn r#type(ctx: JSContextRef, value: JSValueRef) -> JSType {
134        extern "C-unwind" {
135            fn JSValueGetType(ctx: JSContextRef, value: JSValueRef) -> JSType;
136        }
137        unsafe { JSValueGetType(ctx, value) }
138    }
139
140    /// Tests whether a JavaScript value's type is the undefined type.
141    ///
142    /// Parameter `ctx`: The execution context to use.
143    ///
144    /// Parameter `value`: The JSValue to test.
145    ///
146    /// Returns: true if value's type is the undefined type, otherwise false.
147    #[doc(alias = "JSValueIsUndefined")]
148    #[cfg(feature = "JSBase")]
149    #[inline]
150    pub unsafe fn is_undefined(ctx: JSContextRef, value: JSValueRef) -> bool {
151        extern "C-unwind" {
152            fn JSValueIsUndefined(ctx: JSContextRef, value: JSValueRef) -> bool;
153        }
154        unsafe { JSValueIsUndefined(ctx, value) }
155    }
156
157    /// Tests whether a JavaScript value's type is the null type.
158    ///
159    /// Parameter `ctx`: The execution context to use.
160    ///
161    /// Parameter `value`: The JSValue to test.
162    ///
163    /// Returns: true if value's type is the null type, otherwise false.
164    #[doc(alias = "JSValueIsNull")]
165    #[cfg(feature = "JSBase")]
166    #[inline]
167    pub unsafe fn is_null(ctx: JSContextRef, value: JSValueRef) -> bool {
168        extern "C-unwind" {
169            fn JSValueIsNull(ctx: JSContextRef, value: JSValueRef) -> bool;
170        }
171        unsafe { JSValueIsNull(ctx, value) }
172    }
173
174    /// Tests whether a JavaScript value's type is the boolean type.
175    ///
176    /// Parameter `ctx`: The execution context to use.
177    ///
178    /// Parameter `value`: The JSValue to test.
179    ///
180    /// Returns: true if value's type is the boolean type, otherwise false.
181    #[doc(alias = "JSValueIsBoolean")]
182    #[cfg(feature = "JSBase")]
183    #[inline]
184    pub unsafe fn is_boolean(ctx: JSContextRef, value: JSValueRef) -> bool {
185        extern "C-unwind" {
186            fn JSValueIsBoolean(ctx: JSContextRef, value: JSValueRef) -> bool;
187        }
188        unsafe { JSValueIsBoolean(ctx, value) }
189    }
190
191    /// Tests whether a JavaScript value's type is the number type.
192    ///
193    /// Parameter `ctx`: The execution context to use.
194    ///
195    /// Parameter `value`: The JSValue to test.
196    ///
197    /// Returns: true if value's type is the number type, otherwise false.
198    #[doc(alias = "JSValueIsNumber")]
199    #[cfg(feature = "JSBase")]
200    #[inline]
201    pub unsafe fn is_number(ctx: JSContextRef, value: JSValueRef) -> bool {
202        extern "C-unwind" {
203            fn JSValueIsNumber(ctx: JSContextRef, value: JSValueRef) -> bool;
204        }
205        unsafe { JSValueIsNumber(ctx, value) }
206    }
207
208    /// Tests whether a JavaScript value's type is the string type.
209    ///
210    /// Parameter `ctx`: The execution context to use.
211    ///
212    /// Parameter `value`: The JSValue to test.
213    ///
214    /// Returns: true if value's type is the string type, otherwise false.
215    #[doc(alias = "JSValueIsString")]
216    #[cfg(feature = "JSBase")]
217    #[inline]
218    pub unsafe fn is_string(ctx: JSContextRef, value: JSValueRef) -> bool {
219        extern "C-unwind" {
220            fn JSValueIsString(ctx: JSContextRef, value: JSValueRef) -> bool;
221        }
222        unsafe { JSValueIsString(ctx, value) }
223    }
224
225    /// Tests whether a JavaScript value's type is the symbol type.
226    ///
227    /// Parameter `ctx`: The execution context to use.
228    ///
229    /// Parameter `value`: The JSValue to test.
230    ///
231    /// Returns: true if value's type is the symbol type, otherwise false.
232    #[doc(alias = "JSValueIsSymbol")]
233    #[cfg(feature = "JSBase")]
234    #[inline]
235    pub unsafe fn is_symbol(ctx: JSContextRef, value: JSValueRef) -> bool {
236        extern "C-unwind" {
237            fn JSValueIsSymbol(ctx: JSContextRef, value: JSValueRef) -> bool;
238        }
239        unsafe { JSValueIsSymbol(ctx, value) }
240    }
241
242    /// Tests whether a JavaScript value's type is the BigInt type.
243    ///
244    /// Parameter `ctx`: The execution context to use.
245    ///
246    /// Parameter `value`: The JSValue to test.
247    ///
248    /// Returns: true if value's type is the BigInt type, otherwise false.
249    #[doc(alias = "JSValueIsBigInt")]
250    #[cfg(feature = "JSBase")]
251    #[inline]
252    pub unsafe fn is_big_int(ctx: JSContextRef, value: JSValueRef) -> bool {
253        extern "C-unwind" {
254            fn JSValueIsBigInt(ctx: JSContextRef, value: JSValueRef) -> bool;
255        }
256        unsafe { JSValueIsBigInt(ctx, value) }
257    }
258
259    /// Tests whether a JavaScript value's type is the object type.
260    ///
261    /// Parameter `ctx`: The execution context to use.
262    ///
263    /// Parameter `value`: The JSValue to test.
264    ///
265    /// Returns: true if value's type is the object type, otherwise false.
266    #[doc(alias = "JSValueIsObject")]
267    #[cfg(feature = "JSBase")]
268    #[inline]
269    pub unsafe fn is_object(ctx: JSContextRef, value: JSValueRef) -> bool {
270        extern "C-unwind" {
271            fn JSValueIsObject(ctx: JSContextRef, value: JSValueRef) -> bool;
272        }
273        unsafe { JSValueIsObject(ctx, value) }
274    }
275
276    /// Tests whether a JavaScript value is an object with a given class in its class chain.
277    ///
278    /// Parameter `ctx`: The execution context to use.
279    ///
280    /// Parameter `value`: The JSValue to test.
281    ///
282    /// Parameter `jsClass`: The JSClass to test against.
283    ///
284    /// Returns: true if value is an object and has jsClass in its class chain, otherwise false.
285    #[doc(alias = "JSValueIsObjectOfClass")]
286    #[cfg(feature = "JSBase")]
287    #[inline]
288    pub unsafe fn is_object_of_class(
289        ctx: JSContextRef,
290        value: JSValueRef,
291        js_class: JSClassRef,
292    ) -> bool {
293        extern "C-unwind" {
294            fn JSValueIsObjectOfClass(
295                ctx: JSContextRef,
296                value: JSValueRef,
297                js_class: JSClassRef,
298            ) -> bool;
299        }
300        unsafe { JSValueIsObjectOfClass(ctx, value, js_class) }
301    }
302
303    /// Tests whether a JavaScript value is an array.
304    ///
305    /// Parameter `ctx`: The execution context to use.
306    ///
307    /// Parameter `value`: The JSValue to test.
308    ///
309    /// Returns: true if value is an array, otherwise false.
310    #[doc(alias = "JSValueIsArray")]
311    #[cfg(feature = "JSBase")]
312    #[inline]
313    pub unsafe fn is_array(ctx: JSContextRef, value: JSValueRef) -> bool {
314        extern "C-unwind" {
315            fn JSValueIsArray(ctx: JSContextRef, value: JSValueRef) -> bool;
316        }
317        unsafe { JSValueIsArray(ctx, value) }
318    }
319
320    /// Tests whether a JavaScript value is a date.
321    ///
322    /// Parameter `ctx`: The execution context to use.
323    ///
324    /// Parameter `value`: The JSValue to test.
325    ///
326    /// Returns: true if value is a date, otherwise false.
327    #[doc(alias = "JSValueIsDate")]
328    #[cfg(feature = "JSBase")]
329    #[inline]
330    pub unsafe fn is_date(ctx: JSContextRef, value: JSValueRef) -> bool {
331        extern "C-unwind" {
332            fn JSValueIsDate(ctx: JSContextRef, value: JSValueRef) -> bool;
333        }
334        unsafe { JSValueIsDate(ctx, value) }
335    }
336
337    /// Returns a JavaScript value's Typed Array type.
338    ///
339    /// Parameter `ctx`: The execution context to use.
340    ///
341    /// Parameter `value`: The JSValue whose Typed Array type to return.
342    ///
343    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
344    ///
345    /// Returns: A value of type JSTypedArrayType that identifies value's Typed Array type, or kJSTypedArrayTypeNone if the value is not a Typed Array object.
346    #[doc(alias = "JSValueGetTypedArrayType")]
347    #[cfg(feature = "JSBase")]
348    #[inline]
349    pub unsafe fn typed_array_type(
350        ctx: JSContextRef,
351        value: JSValueRef,
352        exception: *mut JSValueRef,
353    ) -> JSTypedArrayType {
354        extern "C-unwind" {
355            fn JSValueGetTypedArrayType(
356                ctx: JSContextRef,
357                value: JSValueRef,
358                exception: *mut JSValueRef,
359            ) -> JSTypedArrayType;
360        }
361        unsafe { JSValueGetTypedArrayType(ctx, value, exception) }
362    }
363
364    /// Tests whether two JavaScript values are equal, as compared by the JS == operator.
365    ///
366    /// Parameter `ctx`: The execution context to use.
367    ///
368    /// Parameter `a`: The first value to test.
369    ///
370    /// Parameter `b`: The second value to test.
371    ///
372    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
373    ///
374    /// Returns: true if the two values are equal, false if they are not equal or an exception is thrown.
375    #[doc(alias = "JSValueIsEqual")]
376    #[cfg(feature = "JSBase")]
377    #[inline]
378    pub unsafe fn is_equal(
379        ctx: JSContextRef,
380        a: JSValueRef,
381        b: JSValueRef,
382        exception: *mut JSValueRef,
383    ) -> bool {
384        extern "C-unwind" {
385            fn JSValueIsEqual(
386                ctx: JSContextRef,
387                a: JSValueRef,
388                b: JSValueRef,
389                exception: *mut JSValueRef,
390            ) -> bool;
391        }
392        unsafe { JSValueIsEqual(ctx, a, b, exception) }
393    }
394
395    /// Tests whether two JavaScript values are strict equal, as compared by the JS === operator.
396    ///
397    /// Parameter `ctx`: The execution context to use.
398    ///
399    /// Parameter `a`: The first value to test.
400    ///
401    /// Parameter `b`: The second value to test.
402    ///
403    /// Returns: true if the two values are strict equal, otherwise false.
404    #[doc(alias = "JSValueIsStrictEqual")]
405    #[cfg(feature = "JSBase")]
406    #[inline]
407    pub unsafe fn is_strict_equal(ctx: JSContextRef, a: JSValueRef, b: JSValueRef) -> bool {
408        extern "C-unwind" {
409            fn JSValueIsStrictEqual(ctx: JSContextRef, a: JSValueRef, b: JSValueRef) -> bool;
410        }
411        unsafe { JSValueIsStrictEqual(ctx, a, b) }
412    }
413
414    /// Tests whether a JavaScript value is an object constructed by a given constructor, as compared by the JS instanceof operator.
415    ///
416    /// Parameter `ctx`: The execution context to use.
417    ///
418    /// Parameter `value`: The JSValue to test.
419    ///
420    /// Parameter `constructor`: The constructor to test against.
421    ///
422    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
423    ///
424    /// Returns: true if value is an object constructed by constructor, as compared by the JS instanceof operator, otherwise false.
425    #[doc(alias = "JSValueIsInstanceOfConstructor")]
426    #[cfg(feature = "JSBase")]
427    #[inline]
428    pub unsafe fn is_instance_of_constructor(
429        ctx: JSContextRef,
430        value: JSValueRef,
431        constructor: JSObjectRef,
432        exception: *mut JSValueRef,
433    ) -> bool {
434        extern "C-unwind" {
435            fn JSValueIsInstanceOfConstructor(
436                ctx: JSContextRef,
437                value: JSValueRef,
438                constructor: JSObjectRef,
439                exception: *mut JSValueRef,
440            ) -> bool;
441        }
442        unsafe { JSValueIsInstanceOfConstructor(ctx, value, constructor, exception) }
443    }
444
445    /// Compares two JSValues.
446    ///
447    /// Parameter `ctx`: The execution context to use.
448    ///
449    /// Parameter `left`: The JSValue as the left operand.
450    ///
451    /// Parameter `right`: The JSValue as the right operand.
452    ///
453    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
454    ///
455    /// Returns: A value of JSRelationCondition, a kJSRelationConditionUndefined is returned if an exception is thrown.
456    ///
457    /// The result is computed by comparing the results of JavaScript's `==`, `
458    /// <
459    /// `, and `>` operators. If either `left` or `right` is (or would coerce to) `NaN` in JavaScript, then the result is kJSRelationConditionUndefined.
460    #[doc(alias = "JSValueCompare")]
461    #[cfg(feature = "JSBase")]
462    #[inline]
463    pub unsafe fn compare(
464        ctx: JSContextRef,
465        left: JSValueRef,
466        right: JSValueRef,
467        exception: *mut JSValueRef,
468    ) -> JSRelationCondition {
469        extern "C-unwind" {
470            fn JSValueCompare(
471                ctx: JSContextRef,
472                left: JSValueRef,
473                right: JSValueRef,
474                exception: *mut JSValueRef,
475            ) -> JSRelationCondition;
476        }
477        unsafe { JSValueCompare(ctx, left, right, exception) }
478    }
479
480    /// Compares a JSValue with a signed 64-bit integer.
481    ///
482    /// Parameter `ctx`: The execution context to use.
483    ///
484    /// Parameter `left`: The JSValue as the left operand.
485    ///
486    /// Parameter `right`: The int64_t as the right operand.
487    ///
488    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
489    ///
490    /// Returns: A value of JSRelationCondition, a kJSRelationConditionUndefined is returned if an exception is thrown.
491    ///
492    /// `left` is converted to an integer according to the rules specified by the JavaScript language then compared with `right`.
493    #[doc(alias = "JSValueCompareInt64")]
494    #[cfg(feature = "JSBase")]
495    #[inline]
496    pub unsafe fn compare_int64(
497        ctx: JSContextRef,
498        left: JSValueRef,
499        right: i64,
500        exception: *mut JSValueRef,
501    ) -> JSRelationCondition {
502        extern "C-unwind" {
503            fn JSValueCompareInt64(
504                ctx: JSContextRef,
505                left: JSValueRef,
506                right: i64,
507                exception: *mut JSValueRef,
508            ) -> JSRelationCondition;
509        }
510        unsafe { JSValueCompareInt64(ctx, left, right, exception) }
511    }
512
513    /// Compares a JSValue with an unsigned 64-bit integer.
514    ///
515    /// Parameter `ctx`: The execution context to use.
516    ///
517    /// Parameter `left`: The JSValue as the left operand.
518    ///
519    /// Parameter `right`: The uint64_t as the right operand.
520    ///
521    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
522    ///
523    /// Returns: A value of JSRelationCondition, a kJSRelationConditionUndefined is returned if an exception is thrown.
524    ///
525    /// `left` is converted to an integer according to the rules specified by the JavaScript language then compared with `right`.
526    #[doc(alias = "JSValueCompareUInt64")]
527    #[cfg(feature = "JSBase")]
528    #[inline]
529    pub unsafe fn compare_u_int64(
530        ctx: JSContextRef,
531        left: JSValueRef,
532        right: u64,
533        exception: *mut JSValueRef,
534    ) -> JSRelationCondition {
535        extern "C-unwind" {
536            fn JSValueCompareUInt64(
537                ctx: JSContextRef,
538                left: JSValueRef,
539                right: u64,
540                exception: *mut JSValueRef,
541            ) -> JSRelationCondition;
542        }
543        unsafe { JSValueCompareUInt64(ctx, left, right, exception) }
544    }
545
546    /// Compares a JSValue with a double.
547    ///
548    /// Parameter `ctx`: The execution context to use.
549    ///
550    /// Parameter `left`: The JSValue as the left operand.
551    ///
552    /// Parameter `right`: The double as the right operand.
553    ///
554    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
555    ///
556    /// Returns: A value of JSRelationCondition, a kJSRelationConditionUndefined is returned if an exception is thrown.
557    ///
558    /// `left` is converted to a double according to the rules specified by the JavaScript language then compared with `right`.
559    #[doc(alias = "JSValueCompareDouble")]
560    #[cfg(feature = "JSBase")]
561    #[inline]
562    pub unsafe fn compare_double(
563        ctx: JSContextRef,
564        left: JSValueRef,
565        right: c_double,
566        exception: *mut JSValueRef,
567    ) -> JSRelationCondition {
568        extern "C-unwind" {
569            fn JSValueCompareDouble(
570                ctx: JSContextRef,
571                left: JSValueRef,
572                right: c_double,
573                exception: *mut JSValueRef,
574            ) -> JSRelationCondition;
575        }
576        unsafe { JSValueCompareDouble(ctx, left, right, exception) }
577    }
578
579    /// Creates a JavaScript value of the undefined type.
580    ///
581    /// Parameter `ctx`: The execution context to use.
582    ///
583    /// Returns: The unique undefined value.
584    #[doc(alias = "JSValueMakeUndefined")]
585    #[cfg(feature = "JSBase")]
586    #[inline]
587    pub unsafe fn new_undefined(ctx: JSContextRef) -> JSValueRef {
588        extern "C-unwind" {
589            fn JSValueMakeUndefined(ctx: JSContextRef) -> JSValueRef;
590        }
591        unsafe { JSValueMakeUndefined(ctx) }
592    }
593
594    /// Creates a JavaScript value of the null type.
595    ///
596    /// Parameter `ctx`: The execution context to use.
597    ///
598    /// Returns: The unique null value.
599    #[doc(alias = "JSValueMakeNull")]
600    #[cfg(feature = "JSBase")]
601    #[inline]
602    pub unsafe fn new_null(ctx: JSContextRef) -> JSValueRef {
603        extern "C-unwind" {
604            fn JSValueMakeNull(ctx: JSContextRef) -> JSValueRef;
605        }
606        unsafe { JSValueMakeNull(ctx) }
607    }
608
609    /// Creates a JavaScript value of the boolean type.
610    ///
611    /// Parameter `ctx`: The execution context to use.
612    ///
613    /// Parameter `boolean`: The bool to assign to the newly created JSValue.
614    ///
615    /// Returns: A JSValue of the boolean type, representing the value of boolean.
616    #[doc(alias = "JSValueMakeBoolean")]
617    #[cfg(feature = "JSBase")]
618    #[inline]
619    pub unsafe fn new_boolean(ctx: JSContextRef, boolean: bool) -> JSValueRef {
620        extern "C-unwind" {
621            fn JSValueMakeBoolean(ctx: JSContextRef, boolean: bool) -> JSValueRef;
622        }
623        unsafe { JSValueMakeBoolean(ctx, boolean) }
624    }
625
626    /// Creates a JavaScript value of the number type.
627    ///
628    /// Parameter `ctx`: The execution context to use.
629    ///
630    /// Parameter `number`: The double to assign to the newly created JSValue.
631    ///
632    /// Returns: A JSValue of the number type, representing the value of number.
633    #[doc(alias = "JSValueMakeNumber")]
634    #[cfg(feature = "JSBase")]
635    #[inline]
636    pub unsafe fn new_number(ctx: JSContextRef, number: c_double) -> JSValueRef {
637        extern "C-unwind" {
638            fn JSValueMakeNumber(ctx: JSContextRef, number: c_double) -> JSValueRef;
639        }
640        unsafe { JSValueMakeNumber(ctx, number) }
641    }
642
643    /// Creates a JavaScript value of the string type.
644    ///
645    /// Parameter `ctx`: The execution context to use.
646    ///
647    /// Parameter `string`: The JSString to assign to the newly created JSValue. The
648    /// newly created JSValue retains string, and releases it upon garbage collection.
649    ///
650    /// Returns: A JSValue of the string type, representing the value of string.
651    #[doc(alias = "JSValueMakeString")]
652    #[cfg(feature = "JSBase")]
653    #[inline]
654    pub unsafe fn new_string(ctx: JSContextRef, string: JSStringRef) -> JSValueRef {
655        extern "C-unwind" {
656            fn JSValueMakeString(ctx: JSContextRef, string: JSStringRef) -> JSValueRef;
657        }
658        unsafe { JSValueMakeString(ctx, string) }
659    }
660
661    /// Creates a JavaScript value of the symbol type.
662    ///
663    /// Parameter `ctx`: The execution context to use.
664    ///
665    /// Parameter `description`: A description of the newly created symbol value.
666    ///
667    /// Returns: A unique JSValue of the symbol type, whose description matches the one provided.
668    #[doc(alias = "JSValueMakeSymbol")]
669    #[cfg(feature = "JSBase")]
670    #[inline]
671    pub unsafe fn new_symbol(ctx: JSContextRef, description: JSStringRef) -> JSValueRef {
672        extern "C-unwind" {
673            fn JSValueMakeSymbol(ctx: JSContextRef, description: JSStringRef) -> JSValueRef;
674        }
675        unsafe { JSValueMakeSymbol(ctx, description) }
676    }
677}
678
679extern "C-unwind" {
680    /// Creates a JavaScript BigInt with a double.
681    ///
682    /// Parameter `ctx`: The execution context to use.
683    ///
684    /// Parameter `value`: The value to copy into the new BigInt JSValue.
685    ///
686    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
687    ///
688    /// Returns: A BigInt JSValue of the value, or NULL if an exception is thrown.
689    ///
690    /// If the value is not an integer, an exception is thrown.
691    #[cfg(feature = "JSBase")]
692    pub fn JSBigIntCreateWithDouble(
693        ctx: JSContextRef,
694        value: c_double,
695        exception: *mut JSValueRef,
696    ) -> JSValueRef;
697}
698
699extern "C-unwind" {
700    /// Creates a JavaScript BigInt with a 64-bit signed integer.
701    ///
702    /// Parameter `ctx`: The execution context to use.
703    ///
704    /// Parameter `integer`: The 64-bit signed integer to copy into the new BigInt JSValue.
705    ///
706    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
707    ///
708    /// Returns: A BigInt JSValue of the integer, or NULL if an exception is thrown.
709    #[cfg(feature = "JSBase")]
710    pub fn JSBigIntCreateWithInt64(
711        ctx: JSContextRef,
712        integer: i64,
713        exception: *mut JSValueRef,
714    ) -> JSValueRef;
715}
716
717extern "C-unwind" {
718    /// Creates a JavaScript BigInt with a 64-bit unsigned integer.
719    ///
720    /// Parameter `ctx`: The execution context to use.
721    ///
722    /// Parameter `integer`: The 64-bit unsigned integer to copy into the new BigInt JSValue.
723    ///
724    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
725    ///
726    /// Returns: A BigInt JSValue of the integer, or NULL if an exception is thrown.
727    #[cfg(feature = "JSBase")]
728    pub fn JSBigIntCreateWithUInt64(
729        ctx: JSContextRef,
730        integer: u64,
731        exception: *mut JSValueRef,
732    ) -> JSValueRef;
733}
734
735extern "C-unwind" {
736    /// Creates a JavaScript BigInt with an integer represented in string.
737    ///
738    /// Parameter `ctx`: The execution context to use.
739    ///
740    /// Parameter `string`: The JSStringRef representation of an integer.
741    ///
742    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
743    ///
744    /// Returns: A BigInt JSValue of the string, or NULL if an exception is thrown.
745    ///
746    /// This is equivalent to calling the `BigInt` constructor from JavaScript with a string argument.
747    #[cfg(feature = "JSBase")]
748    pub fn JSBigIntCreateWithString(
749        ctx: JSContextRef,
750        string: JSStringRef,
751        exception: *mut JSValueRef,
752    ) -> JSValueRef;
753}
754
755#[cfg(all(feature = "JSValue", feature = "objc2"))]
756impl JSValue {
757    /// Creates a JavaScript value from a JSON formatted string.
758    ///
759    /// Parameter `ctx`: The execution context to use.
760    ///
761    /// Parameter `string`: The JSString containing the JSON string to be parsed.
762    ///
763    /// Returns: A JSValue containing the parsed value, or NULL if the input is invalid.
764    #[doc(alias = "JSValueMakeFromJSONString")]
765    #[cfg(feature = "JSBase")]
766    #[inline]
767    pub unsafe fn from_json_string(ctx: JSContextRef, string: JSStringRef) -> JSValueRef {
768        extern "C-unwind" {
769            fn JSValueMakeFromJSONString(ctx: JSContextRef, string: JSStringRef) -> JSValueRef;
770        }
771        unsafe { JSValueMakeFromJSONString(ctx, string) }
772    }
773
774    /// Creates a JavaScript string containing the JSON serialized representation of a JS value.
775    ///
776    /// Parameter `ctx`: The execution context to use.
777    ///
778    /// Parameter `value`: The value to serialize.
779    ///
780    /// Parameter `indent`: The number of spaces to indent when nesting.  If 0, the resulting JSON will not contains newlines.  The size of the indent is clamped to 10 spaces.
781    ///
782    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
783    ///
784    /// Returns: A JSString with the result of serialization, or NULL if an exception is thrown.
785    #[doc(alias = "JSValueCreateJSONString")]
786    #[cfg(feature = "JSBase")]
787    #[inline]
788    pub unsafe fn create_json_string(
789        ctx: JSContextRef,
790        value: JSValueRef,
791        indent: c_uint,
792        exception: *mut JSValueRef,
793    ) -> JSStringRef {
794        extern "C-unwind" {
795            fn JSValueCreateJSONString(
796                ctx: JSContextRef,
797                value: JSValueRef,
798                indent: c_uint,
799                exception: *mut JSValueRef,
800            ) -> JSStringRef;
801        }
802        unsafe { JSValueCreateJSONString(ctx, value, indent, exception) }
803    }
804
805    /// Converts a JavaScript value to boolean and returns the resulting boolean.
806    ///
807    /// Parameter `ctx`: The execution context to use.
808    ///
809    /// Parameter `value`: The JSValue to convert.
810    ///
811    /// Returns: The boolean result of conversion.
812    #[doc(alias = "JSValueToBoolean")]
813    #[cfg(feature = "JSBase")]
814    #[inline]
815    pub unsafe fn to_boolean(ctx: JSContextRef, value: JSValueRef) -> bool {
816        extern "C-unwind" {
817            fn JSValueToBoolean(ctx: JSContextRef, value: JSValueRef) -> bool;
818        }
819        unsafe { JSValueToBoolean(ctx, value) }
820    }
821
822    /// Converts a JavaScript value to number and returns the resulting number.
823    ///
824    /// Parameter `ctx`: The execution context to use.
825    ///
826    /// Parameter `value`: The JSValue to convert.
827    ///
828    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
829    ///
830    /// Returns: The numeric result of conversion, or NaN if an exception is thrown.
831    ///
832    /// The result is equivalent to `Number(value)` in JavaScript.
833    #[doc(alias = "JSValueToNumber")]
834    #[cfg(feature = "JSBase")]
835    #[inline]
836    pub unsafe fn to_number(
837        ctx: JSContextRef,
838        value: JSValueRef,
839        exception: *mut JSValueRef,
840    ) -> c_double {
841        extern "C-unwind" {
842            fn JSValueToNumber(
843                ctx: JSContextRef,
844                value: JSValueRef,
845                exception: *mut JSValueRef,
846            ) -> c_double;
847        }
848        unsafe { JSValueToNumber(ctx, value, exception) }
849    }
850
851    /// Converts a JSValue to a singed 32-bit integer and returns the resulting integer.
852    ///
853    /// Parameter `ctx`: The execution context to use.
854    ///
855    /// Parameter `value`: The JSValue to convert.
856    ///
857    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
858    ///
859    /// Returns: An int32_t with the result of conversion, or 0 if an exception is thrown. Since 0 is valid value, `exception` must be checked after the call.
860    ///
861    /// The JSValue is converted to an integer according to the rules specified by the JavaScript language. If the value is a BigInt, then the JSValue is truncated to an int32_t.
862    #[doc(alias = "JSValueToInt32")]
863    #[cfg(feature = "JSBase")]
864    #[inline]
865    pub unsafe fn to_int32(
866        ctx: JSContextRef,
867        value: JSValueRef,
868        exception: *mut JSValueRef,
869    ) -> i32 {
870        extern "C-unwind" {
871            fn JSValueToInt32(
872                ctx: JSContextRef,
873                value: JSValueRef,
874                exception: *mut JSValueRef,
875            ) -> i32;
876        }
877        unsafe { JSValueToInt32(ctx, value, exception) }
878    }
879
880    /// Converts a JSValue to an unsigned 32-bit integer and returns the resulting integer.
881    ///
882    /// Parameter `ctx`: The execution context to use.
883    ///
884    /// Parameter `value`: The JSValue to convert.
885    ///
886    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
887    ///
888    /// Returns: A uint32_t with the result of conversion, or 0 if an exception is thrown. Since 0 is valid value, `exception` must be checked after the call.
889    ///
890    /// The JSValue is converted to an integer according to the rules specified by the JavaScript language. If the value is a BigInt, then the JSValue is truncated to a uint32_t.
891    #[doc(alias = "JSValueToUInt32")]
892    #[cfg(feature = "JSBase")]
893    #[inline]
894    pub unsafe fn to_u_int32(
895        ctx: JSContextRef,
896        value: JSValueRef,
897        exception: *mut JSValueRef,
898    ) -> u32 {
899        extern "C-unwind" {
900            fn JSValueToUInt32(
901                ctx: JSContextRef,
902                value: JSValueRef,
903                exception: *mut JSValueRef,
904            ) -> u32;
905        }
906        unsafe { JSValueToUInt32(ctx, value, exception) }
907    }
908
909    /// Converts a JSValue to a singed 64-bit integer and returns the resulting integer.
910    ///
911    /// Parameter `ctx`: The execution context to use.
912    ///
913    /// Parameter `value`: The JSValue to convert.
914    ///
915    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
916    ///
917    /// Returns: An int64_t with the result of conversion, or 0 if an exception is thrown. Since 0 is valid value, `exception` must be checked after the call.
918    ///
919    /// The JSValue is converted to an integer according to the rules specified by the JavaScript language. If the value is a BigInt, then the JSValue is truncated to an int64_t.
920    #[doc(alias = "JSValueToInt64")]
921    #[cfg(feature = "JSBase")]
922    #[inline]
923    pub unsafe fn to_int64(
924        ctx: JSContextRef,
925        value: JSValueRef,
926        exception: *mut JSValueRef,
927    ) -> i64 {
928        extern "C-unwind" {
929            fn JSValueToInt64(
930                ctx: JSContextRef,
931                value: JSValueRef,
932                exception: *mut JSValueRef,
933            ) -> i64;
934        }
935        unsafe { JSValueToInt64(ctx, value, exception) }
936    }
937
938    /// Converts a JSValue to an unsigned 64-bit integer and returns the resulting integer.
939    ///
940    /// Parameter `ctx`: The execution context to use.
941    ///
942    /// Parameter `value`: The JSValue to convert.
943    ///
944    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
945    ///
946    /// Returns: A uint64_t with the result of conversion, or 0 if an exception is thrown. Since 0 is valid value, `exception` must be checked after the call.
947    ///
948    /// The JSValue is converted to an integer according to the rules specified by the JavaScript language. If the value is a BigInt, then the JSValue is truncated to a uint64_t.
949    #[doc(alias = "JSValueToUInt64")]
950    #[cfg(feature = "JSBase")]
951    #[inline]
952    pub unsafe fn to_u_int64(
953        ctx: JSContextRef,
954        value: JSValueRef,
955        exception: *mut JSValueRef,
956    ) -> u64 {
957        extern "C-unwind" {
958            fn JSValueToUInt64(
959                ctx: JSContextRef,
960                value: JSValueRef,
961                exception: *mut JSValueRef,
962            ) -> u64;
963        }
964        unsafe { JSValueToUInt64(ctx, value, exception) }
965    }
966
967    /// Converts a JavaScript value to string and copies the result into a JavaScript string.
968    ///
969    /// Parameter `ctx`: The execution context to use.
970    ///
971    /// Parameter `value`: The JSValue to convert.
972    ///
973    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
974    ///
975    /// Returns: A JSString with the result of conversion, or NULL if an exception is thrown. Ownership follows the Create Rule.
976    #[doc(alias = "JSValueToStringCopy")]
977    #[cfg(feature = "JSBase")]
978    #[inline]
979    pub unsafe fn to_string_copy(
980        ctx: JSContextRef,
981        value: JSValueRef,
982        exception: *mut JSValueRef,
983    ) -> JSStringRef {
984        extern "C-unwind" {
985            fn JSValueToStringCopy(
986                ctx: JSContextRef,
987                value: JSValueRef,
988                exception: *mut JSValueRef,
989            ) -> JSStringRef;
990        }
991        unsafe { JSValueToStringCopy(ctx, value, exception) }
992    }
993
994    /// Converts a JavaScript value to object and returns the resulting object.
995    ///
996    /// Parameter `ctx`: The execution context to use.
997    ///
998    /// Parameter `value`: The JSValue to convert.
999    ///
1000    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
1001    ///
1002    /// Returns: The JSObject result of conversion, or NULL if an exception is thrown.
1003    #[doc(alias = "JSValueToObject")]
1004    #[cfg(feature = "JSBase")]
1005    #[inline]
1006    pub unsafe fn to_object(
1007        ctx: JSContextRef,
1008        value: JSValueRef,
1009        exception: *mut JSValueRef,
1010    ) -> JSObjectRef {
1011        extern "C-unwind" {
1012            fn JSValueToObject(
1013                ctx: JSContextRef,
1014                value: JSValueRef,
1015                exception: *mut JSValueRef,
1016            ) -> JSObjectRef;
1017        }
1018        unsafe { JSValueToObject(ctx, value, exception) }
1019    }
1020
1021    /// Protects a JavaScript value from garbage collection.
1022    ///
1023    /// Parameter `ctx`: The execution context to use.
1024    ///
1025    /// Parameter `value`: The JSValue to protect.
1026    ///
1027    /// Use this method when you want to store a JSValue in a global or on the heap, where the garbage collector will not be able to discover your reference to it.
1028    ///
1029    /// A value may be protected multiple times and must be unprotected an equal number of times before becoming eligible for garbage collection.
1030    #[doc(alias = "JSValueProtect")]
1031    #[cfg(feature = "JSBase")]
1032    #[inline]
1033    pub unsafe fn protect(ctx: JSContextRef, value: JSValueRef) {
1034        extern "C-unwind" {
1035            fn JSValueProtect(ctx: JSContextRef, value: JSValueRef);
1036        }
1037        unsafe { JSValueProtect(ctx, value) }
1038    }
1039
1040    /// Unprotects a JavaScript value from garbage collection.
1041    ///
1042    /// Parameter `ctx`: The execution context to use.
1043    ///
1044    /// Parameter `value`: The JSValue to unprotect.
1045    ///
1046    /// A value may be protected multiple times and must be unprotected an
1047    /// equal number of times before becoming eligible for garbage collection.
1048    #[doc(alias = "JSValueUnprotect")]
1049    #[cfg(feature = "JSBase")]
1050    #[inline]
1051    pub unsafe fn unprotect(ctx: JSContextRef, value: JSValueRef) {
1052        extern "C-unwind" {
1053            fn JSValueUnprotect(ctx: JSContextRef, value: JSValueRef);
1054        }
1055        unsafe { JSValueUnprotect(ctx, value) }
1056    }
1057}
1058
1059extern "C-unwind" {
1060    #[cfg(feature = "JSBase")]
1061    #[deprecated = "renamed to `JSValue::type`"]
1062    pub fn JSValueGetType(ctx: JSContextRef, value: JSValueRef) -> JSType;
1063}
1064
1065extern "C-unwind" {
1066    #[cfg(feature = "JSBase")]
1067    #[deprecated = "renamed to `JSValue::is_undefined`"]
1068    pub fn JSValueIsUndefined(ctx: JSContextRef, value: JSValueRef) -> bool;
1069}
1070
1071extern "C-unwind" {
1072    #[cfg(feature = "JSBase")]
1073    #[deprecated = "renamed to `JSValue::is_null`"]
1074    pub fn JSValueIsNull(ctx: JSContextRef, value: JSValueRef) -> bool;
1075}
1076
1077extern "C-unwind" {
1078    #[cfg(feature = "JSBase")]
1079    #[deprecated = "renamed to `JSValue::is_boolean`"]
1080    pub fn JSValueIsBoolean(ctx: JSContextRef, value: JSValueRef) -> bool;
1081}
1082
1083extern "C-unwind" {
1084    #[cfg(feature = "JSBase")]
1085    #[deprecated = "renamed to `JSValue::is_number`"]
1086    pub fn JSValueIsNumber(ctx: JSContextRef, value: JSValueRef) -> bool;
1087}
1088
1089extern "C-unwind" {
1090    #[cfg(feature = "JSBase")]
1091    #[deprecated = "renamed to `JSValue::is_string`"]
1092    pub fn JSValueIsString(ctx: JSContextRef, value: JSValueRef) -> bool;
1093}
1094
1095extern "C-unwind" {
1096    #[cfg(feature = "JSBase")]
1097    #[deprecated = "renamed to `JSValue::is_symbol`"]
1098    pub fn JSValueIsSymbol(ctx: JSContextRef, value: JSValueRef) -> bool;
1099}
1100
1101extern "C-unwind" {
1102    #[cfg(feature = "JSBase")]
1103    #[deprecated = "renamed to `JSValue::is_big_int`"]
1104    pub fn JSValueIsBigInt(ctx: JSContextRef, value: JSValueRef) -> bool;
1105}
1106
1107extern "C-unwind" {
1108    #[cfg(feature = "JSBase")]
1109    #[deprecated = "renamed to `JSValue::is_object`"]
1110    pub fn JSValueIsObject(ctx: JSContextRef, value: JSValueRef) -> bool;
1111}
1112
1113extern "C-unwind" {
1114    #[cfg(feature = "JSBase")]
1115    #[deprecated = "renamed to `JSValue::is_object_of_class`"]
1116    pub fn JSValueIsObjectOfClass(
1117        ctx: JSContextRef,
1118        value: JSValueRef,
1119        js_class: JSClassRef,
1120    ) -> bool;
1121}
1122
1123extern "C-unwind" {
1124    #[cfg(feature = "JSBase")]
1125    #[deprecated = "renamed to `JSValue::is_array`"]
1126    pub fn JSValueIsArray(ctx: JSContextRef, value: JSValueRef) -> bool;
1127}
1128
1129extern "C-unwind" {
1130    #[cfg(feature = "JSBase")]
1131    #[deprecated = "renamed to `JSValue::is_date`"]
1132    pub fn JSValueIsDate(ctx: JSContextRef, value: JSValueRef) -> bool;
1133}
1134
1135extern "C-unwind" {
1136    #[cfg(feature = "JSBase")]
1137    #[deprecated = "renamed to `JSValue::typed_array_type`"]
1138    pub fn JSValueGetTypedArrayType(
1139        ctx: JSContextRef,
1140        value: JSValueRef,
1141        exception: *mut JSValueRef,
1142    ) -> JSTypedArrayType;
1143}
1144
1145extern "C-unwind" {
1146    #[cfg(feature = "JSBase")]
1147    #[deprecated = "renamed to `JSValue::is_equal`"]
1148    pub fn JSValueIsEqual(
1149        ctx: JSContextRef,
1150        a: JSValueRef,
1151        b: JSValueRef,
1152        exception: *mut JSValueRef,
1153    ) -> bool;
1154}
1155
1156extern "C-unwind" {
1157    #[cfg(feature = "JSBase")]
1158    #[deprecated = "renamed to `JSValue::is_strict_equal`"]
1159    pub fn JSValueIsStrictEqual(ctx: JSContextRef, a: JSValueRef, b: JSValueRef) -> bool;
1160}
1161
1162extern "C-unwind" {
1163    #[cfg(feature = "JSBase")]
1164    #[deprecated = "renamed to `JSValue::is_instance_of_constructor`"]
1165    pub fn JSValueIsInstanceOfConstructor(
1166        ctx: JSContextRef,
1167        value: JSValueRef,
1168        constructor: JSObjectRef,
1169        exception: *mut JSValueRef,
1170    ) -> bool;
1171}
1172
1173extern "C-unwind" {
1174    #[cfg(feature = "JSBase")]
1175    #[deprecated = "renamed to `JSValue::compare`"]
1176    pub fn JSValueCompare(
1177        ctx: JSContextRef,
1178        left: JSValueRef,
1179        right: JSValueRef,
1180        exception: *mut JSValueRef,
1181    ) -> JSRelationCondition;
1182}
1183
1184extern "C-unwind" {
1185    #[cfg(feature = "JSBase")]
1186    #[deprecated = "renamed to `JSValue::compare_int64`"]
1187    pub fn JSValueCompareInt64(
1188        ctx: JSContextRef,
1189        left: JSValueRef,
1190        right: i64,
1191        exception: *mut JSValueRef,
1192    ) -> JSRelationCondition;
1193}
1194
1195extern "C-unwind" {
1196    #[cfg(feature = "JSBase")]
1197    #[deprecated = "renamed to `JSValue::compare_u_int64`"]
1198    pub fn JSValueCompareUInt64(
1199        ctx: JSContextRef,
1200        left: JSValueRef,
1201        right: u64,
1202        exception: *mut JSValueRef,
1203    ) -> JSRelationCondition;
1204}
1205
1206extern "C-unwind" {
1207    #[cfg(feature = "JSBase")]
1208    #[deprecated = "renamed to `JSValue::compare_double`"]
1209    pub fn JSValueCompareDouble(
1210        ctx: JSContextRef,
1211        left: JSValueRef,
1212        right: c_double,
1213        exception: *mut JSValueRef,
1214    ) -> JSRelationCondition;
1215}
1216
1217extern "C-unwind" {
1218    #[cfg(feature = "JSBase")]
1219    #[deprecated = "renamed to `JSValue::new_undefined`"]
1220    pub fn JSValueMakeUndefined(ctx: JSContextRef) -> JSValueRef;
1221}
1222
1223extern "C-unwind" {
1224    #[cfg(feature = "JSBase")]
1225    #[deprecated = "renamed to `JSValue::new_null`"]
1226    pub fn JSValueMakeNull(ctx: JSContextRef) -> JSValueRef;
1227}
1228
1229extern "C-unwind" {
1230    #[cfg(feature = "JSBase")]
1231    #[deprecated = "renamed to `JSValue::new_boolean`"]
1232    pub fn JSValueMakeBoolean(ctx: JSContextRef, boolean: bool) -> JSValueRef;
1233}
1234
1235extern "C-unwind" {
1236    #[cfg(feature = "JSBase")]
1237    #[deprecated = "renamed to `JSValue::new_number`"]
1238    pub fn JSValueMakeNumber(ctx: JSContextRef, number: c_double) -> JSValueRef;
1239}
1240
1241extern "C-unwind" {
1242    #[cfg(feature = "JSBase")]
1243    #[deprecated = "renamed to `JSValue::new_string`"]
1244    pub fn JSValueMakeString(ctx: JSContextRef, string: JSStringRef) -> JSValueRef;
1245}
1246
1247extern "C-unwind" {
1248    #[cfg(feature = "JSBase")]
1249    #[deprecated = "renamed to `JSValue::new_symbol`"]
1250    pub fn JSValueMakeSymbol(ctx: JSContextRef, description: JSStringRef) -> JSValueRef;
1251}
1252
1253extern "C-unwind" {
1254    #[cfg(feature = "JSBase")]
1255    #[deprecated = "renamed to `JSValue::from_json_string`"]
1256    pub fn JSValueMakeFromJSONString(ctx: JSContextRef, string: JSStringRef) -> JSValueRef;
1257}
1258
1259extern "C-unwind" {
1260    #[cfg(feature = "JSBase")]
1261    #[deprecated = "renamed to `JSValue::create_json_string`"]
1262    pub fn JSValueCreateJSONString(
1263        ctx: JSContextRef,
1264        value: JSValueRef,
1265        indent: c_uint,
1266        exception: *mut JSValueRef,
1267    ) -> JSStringRef;
1268}
1269
1270extern "C-unwind" {
1271    #[cfg(feature = "JSBase")]
1272    #[deprecated = "renamed to `JSValue::to_boolean`"]
1273    pub fn JSValueToBoolean(ctx: JSContextRef, value: JSValueRef) -> bool;
1274}
1275
1276extern "C-unwind" {
1277    #[cfg(feature = "JSBase")]
1278    #[deprecated = "renamed to `JSValue::to_number`"]
1279    pub fn JSValueToNumber(
1280        ctx: JSContextRef,
1281        value: JSValueRef,
1282        exception: *mut JSValueRef,
1283    ) -> c_double;
1284}
1285
1286extern "C-unwind" {
1287    #[cfg(feature = "JSBase")]
1288    #[deprecated = "renamed to `JSValue::to_int32`"]
1289    pub fn JSValueToInt32(ctx: JSContextRef, value: JSValueRef, exception: *mut JSValueRef) -> i32;
1290}
1291
1292extern "C-unwind" {
1293    #[cfg(feature = "JSBase")]
1294    #[deprecated = "renamed to `JSValue::to_u_int32`"]
1295    pub fn JSValueToUInt32(ctx: JSContextRef, value: JSValueRef, exception: *mut JSValueRef)
1296        -> u32;
1297}
1298
1299extern "C-unwind" {
1300    #[cfg(feature = "JSBase")]
1301    #[deprecated = "renamed to `JSValue::to_int64`"]
1302    pub fn JSValueToInt64(ctx: JSContextRef, value: JSValueRef, exception: *mut JSValueRef) -> i64;
1303}
1304
1305extern "C-unwind" {
1306    #[cfg(feature = "JSBase")]
1307    #[deprecated = "renamed to `JSValue::to_u_int64`"]
1308    pub fn JSValueToUInt64(ctx: JSContextRef, value: JSValueRef, exception: *mut JSValueRef)
1309        -> u64;
1310}
1311
1312extern "C-unwind" {
1313    #[cfg(feature = "JSBase")]
1314    #[deprecated = "renamed to `JSValue::to_string_copy`"]
1315    pub fn JSValueToStringCopy(
1316        ctx: JSContextRef,
1317        value: JSValueRef,
1318        exception: *mut JSValueRef,
1319    ) -> JSStringRef;
1320}
1321
1322extern "C-unwind" {
1323    #[cfg(feature = "JSBase")]
1324    #[deprecated = "renamed to `JSValue::to_object`"]
1325    pub fn JSValueToObject(
1326        ctx: JSContextRef,
1327        value: JSValueRef,
1328        exception: *mut JSValueRef,
1329    ) -> JSObjectRef;
1330}
1331
1332extern "C-unwind" {
1333    #[cfg(feature = "JSBase")]
1334    #[deprecated = "renamed to `JSValue::protect`"]
1335    pub fn JSValueProtect(ctx: JSContextRef, value: JSValueRef);
1336}
1337
1338extern "C-unwind" {
1339    #[cfg(feature = "JSBase")]
1340    #[deprecated = "renamed to `JSValue::unprotect`"]
1341    pub fn JSValueUnprotect(ctx: JSContextRef, value: JSValueRef);
1342}