Skip to main content

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 { Some(value.assume_init()) } else { None }
57    }
58}
59
60#[doc(alias = "jsc_options_get_int")]
61pub fn options_get_int(option: &str) -> Option<i32> {
62    assert_initialized_main_thread!();
63    unsafe {
64        let mut value = std::mem::MaybeUninit::uninit();
65        let ret = from_glib(ffi::jsc_options_get_int(
66            option.to_glib_none().0,
67            value.as_mut_ptr(),
68        ));
69        if ret { Some(value.assume_init()) } else { None }
70    }
71}
72
73//#[doc(alias = "jsc_options_get_option_group")]
74//pub fn options_get_option_group() -> /*Ignored*/Option<glib::OptionGroup> {
75//    unsafe { TODO: call ffi:jsc_options_get_option_group() }
76//}
77
78#[doc(alias = "jsc_options_get_range_string")]
79pub fn options_get_range_string(option: &str) -> Option<glib::GString> {
80    assert_initialized_main_thread!();
81    unsafe {
82        let mut value = std::ptr::null_mut();
83        let ret = from_glib(ffi::jsc_options_get_range_string(
84            option.to_glib_none().0,
85            &mut value,
86        ));
87        if ret {
88            Some(from_glib_full(value))
89        } else {
90            None
91        }
92    }
93}
94
95#[doc(alias = "jsc_options_get_size")]
96pub fn options_get_size(option: &str) -> Option<usize> {
97    assert_initialized_main_thread!();
98    unsafe {
99        let mut value = std::mem::MaybeUninit::uninit();
100        let ret = from_glib(ffi::jsc_options_get_size(
101            option.to_glib_none().0,
102            value.as_mut_ptr(),
103        ));
104        if ret { Some(value.assume_init()) } else { None }
105    }
106}
107
108#[doc(alias = "jsc_options_get_string")]
109pub fn options_get_string(option: &str) -> Option<glib::GString> {
110    assert_initialized_main_thread!();
111    unsafe {
112        let mut value = std::ptr::null_mut();
113        let ret = from_glib(ffi::jsc_options_get_string(
114            option.to_glib_none().0,
115            &mut value,
116        ));
117        if ret {
118            Some(from_glib_full(value))
119        } else {
120            None
121        }
122    }
123}
124
125#[doc(alias = "jsc_options_get_uint")]
126pub fn options_get_uint(option: &str) -> Option<u32> {
127    assert_initialized_main_thread!();
128    unsafe {
129        let mut value = std::mem::MaybeUninit::uninit();
130        let ret = from_glib(ffi::jsc_options_get_uint(
131            option.to_glib_none().0,
132            value.as_mut_ptr(),
133        ));
134        if ret { Some(value.assume_init()) } else { None }
135    }
136}
137
138#[doc(alias = "jsc_options_set_boolean")]
139pub fn options_set_boolean(option: &str, value: bool) -> bool {
140    assert_initialized_main_thread!();
141    unsafe {
142        from_glib(ffi::jsc_options_set_boolean(
143            option.to_glib_none().0,
144            value.into_glib(),
145        ))
146    }
147}
148
149#[doc(alias = "jsc_options_set_double")]
150pub fn options_set_double(option: &str, value: f64) -> bool {
151    assert_initialized_main_thread!();
152    unsafe { from_glib(ffi::jsc_options_set_double(option.to_glib_none().0, value)) }
153}
154
155#[doc(alias = "jsc_options_set_int")]
156pub fn options_set_int(option: &str, value: i32) -> bool {
157    assert_initialized_main_thread!();
158    unsafe { from_glib(ffi::jsc_options_set_int(option.to_glib_none().0, value)) }
159}
160
161#[doc(alias = "jsc_options_set_range_string")]
162pub fn options_set_range_string(option: &str, value: &str) -> bool {
163    assert_initialized_main_thread!();
164    unsafe {
165        from_glib(ffi::jsc_options_set_range_string(
166            option.to_glib_none().0,
167            value.to_glib_none().0,
168        ))
169    }
170}
171
172#[doc(alias = "jsc_options_set_size")]
173pub fn options_set_size(option: &str, value: usize) -> bool {
174    assert_initialized_main_thread!();
175    unsafe { from_glib(ffi::jsc_options_set_size(option.to_glib_none().0, value)) }
176}
177
178#[doc(alias = "jsc_options_set_string")]
179pub fn options_set_string(option: &str, value: &str) -> bool {
180    assert_initialized_main_thread!();
181    unsafe {
182        from_glib(ffi::jsc_options_set_string(
183            option.to_glib_none().0,
184            value.to_glib_none().0,
185        ))
186    }
187}
188
189#[doc(alias = "jsc_options_set_uint")]
190pub fn options_set_uint(option: &str, value: u32) -> bool {
191    assert_initialized_main_thread!();
192    unsafe { from_glib(ffi::jsc_options_set_uint(option.to_glib_none().0, value)) }
193}