javascriptcore6/auto/
functions.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from webkit-gir-files
4// DO NOT EDIT
5
6use crate::ffi;
7use glib::translate::*;
8
9#[doc(alias = "jsc_get_major_version")]
10#[doc(alias = "get_major_version")]
11pub fn major_version() -> u32 {
12    assert_initialized_main_thread!();
13    unsafe { ffi::jsc_get_major_version() }
14}
15
16#[doc(alias = "jsc_get_micro_version")]
17#[doc(alias = "get_micro_version")]
18pub fn micro_version() -> u32 {
19    assert_initialized_main_thread!();
20    unsafe { ffi::jsc_get_micro_version() }
21}
22
23#[doc(alias = "jsc_get_minor_version")]
24#[doc(alias = "get_minor_version")]
25pub fn minor_version() -> u32 {
26    assert_initialized_main_thread!();
27    unsafe { ffi::jsc_get_minor_version() }
28}
29
30#[doc(alias = "jsc_options_get_boolean")]
31pub fn options_get_boolean(option: &str) -> Option<bool> {
32    assert_initialized_main_thread!();
33    unsafe {
34        let mut value = std::mem::MaybeUninit::uninit();
35        let ret = from_glib(ffi::jsc_options_get_boolean(
36            option.to_glib_none().0,
37            value.as_mut_ptr(),
38        ));
39        if ret {
40            Some(from_glib(value.assume_init()))
41        } else {
42            None
43        }
44    }
45}
46
47#[doc(alias = "jsc_options_get_double")]
48pub fn options_get_double(option: &str) -> Option<f64> {
49    assert_initialized_main_thread!();
50    unsafe {
51        let mut value = std::mem::MaybeUninit::uninit();
52        let ret = from_glib(ffi::jsc_options_get_double(
53            option.to_glib_none().0,
54            value.as_mut_ptr(),
55        ));
56        if ret {
57            Some(value.assume_init())
58        } else {
59            None
60        }
61    }
62}
63
64#[doc(alias = "jsc_options_get_int")]
65pub fn options_get_int(option: &str) -> Option<i32> {
66    assert_initialized_main_thread!();
67    unsafe {
68        let mut value = std::mem::MaybeUninit::uninit();
69        let ret = from_glib(ffi::jsc_options_get_int(
70            option.to_glib_none().0,
71            value.as_mut_ptr(),
72        ));
73        if ret {
74            Some(value.assume_init())
75        } else {
76            None
77        }
78    }
79}
80
81//#[doc(alias = "jsc_options_get_option_group")]
82//pub fn options_get_option_group() -> /*Ignored*/Option<glib::OptionGroup> {
83//    unsafe { TODO: call ffi:jsc_options_get_option_group() }
84//}
85
86#[doc(alias = "jsc_options_get_range_string")]
87pub fn options_get_range_string(option: &str) -> Option<glib::GString> {
88    assert_initialized_main_thread!();
89    unsafe {
90        let mut value = std::ptr::null_mut();
91        let ret = from_glib(ffi::jsc_options_get_range_string(
92            option.to_glib_none().0,
93            &mut value,
94        ));
95        if ret {
96            Some(from_glib_full(value))
97        } else {
98            None
99        }
100    }
101}
102
103#[doc(alias = "jsc_options_get_size")]
104pub fn options_get_size(option: &str) -> Option<usize> {
105    assert_initialized_main_thread!();
106    unsafe {
107        let mut value = std::mem::MaybeUninit::uninit();
108        let ret = from_glib(ffi::jsc_options_get_size(
109            option.to_glib_none().0,
110            value.as_mut_ptr(),
111        ));
112        if ret {
113            Some(value.assume_init())
114        } else {
115            None
116        }
117    }
118}
119
120#[doc(alias = "jsc_options_get_string")]
121pub fn options_get_string(option: &str) -> Option<glib::GString> {
122    assert_initialized_main_thread!();
123    unsafe {
124        let mut value = std::ptr::null_mut();
125        let ret = from_glib(ffi::jsc_options_get_string(
126            option.to_glib_none().0,
127            &mut value,
128        ));
129        if ret {
130            Some(from_glib_full(value))
131        } else {
132            None
133        }
134    }
135}
136
137#[doc(alias = "jsc_options_get_uint")]
138pub fn options_get_uint(option: &str) -> Option<u32> {
139    assert_initialized_main_thread!();
140    unsafe {
141        let mut value = std::mem::MaybeUninit::uninit();
142        let ret = from_glib(ffi::jsc_options_get_uint(
143            option.to_glib_none().0,
144            value.as_mut_ptr(),
145        ));
146        if ret {
147            Some(value.assume_init())
148        } else {
149            None
150        }
151    }
152}
153
154#[doc(alias = "jsc_options_set_boolean")]
155pub fn options_set_boolean(option: &str, value: bool) -> bool {
156    assert_initialized_main_thread!();
157    unsafe {
158        from_glib(ffi::jsc_options_set_boolean(
159            option.to_glib_none().0,
160            value.into_glib(),
161        ))
162    }
163}
164
165#[doc(alias = "jsc_options_set_double")]
166pub fn options_set_double(option: &str, value: f64) -> bool {
167    assert_initialized_main_thread!();
168    unsafe { from_glib(ffi::jsc_options_set_double(option.to_glib_none().0, value)) }
169}
170
171#[doc(alias = "jsc_options_set_int")]
172pub fn options_set_int(option: &str, value: i32) -> bool {
173    assert_initialized_main_thread!();
174    unsafe { from_glib(ffi::jsc_options_set_int(option.to_glib_none().0, value)) }
175}
176
177#[doc(alias = "jsc_options_set_range_string")]
178pub fn options_set_range_string(option: &str, value: &str) -> bool {
179    assert_initialized_main_thread!();
180    unsafe {
181        from_glib(ffi::jsc_options_set_range_string(
182            option.to_glib_none().0,
183            value.to_glib_none().0,
184        ))
185    }
186}
187
188#[doc(alias = "jsc_options_set_size")]
189pub fn options_set_size(option: &str, value: usize) -> bool {
190    assert_initialized_main_thread!();
191    unsafe { from_glib(ffi::jsc_options_set_size(option.to_glib_none().0, value)) }
192}
193
194#[doc(alias = "jsc_options_set_string")]
195pub fn options_set_string(option: &str, value: &str) -> bool {
196    assert_initialized_main_thread!();
197    unsafe {
198        from_glib(ffi::jsc_options_set_string(
199            option.to_glib_none().0,
200            value.to_glib_none().0,
201        ))
202    }
203}
204
205#[doc(alias = "jsc_options_set_uint")]
206pub fn options_set_uint(option: &str, value: u32) -> bool {
207    assert_initialized_main_thread!();
208    unsafe { from_glib(ffi::jsc_options_set_uint(option.to_glib_none().0, value)) }
209}