1use core::ffi::*;
4#[cfg(feature = "objc2")]
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9#[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#[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#[repr(transparent)]
94#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
95pub struct JSRelationCondition(pub u32);
96impl JSRelationCondition {
97 #[doc(alias = "kJSRelationConditionUndefined")]
99 pub const Undefined: Self = Self(0);
100 #[doc(alias = "kJSRelationConditionEqual")]
102 pub const Equal: Self = Self(1);
103 #[doc(alias = "kJSRelationConditionGreaterThan")]
105 pub const GreaterThan: Self = Self(2);
106 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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}