cxx_qt_lib/core/qset/
qset_i16.rs

1// SPDX-FileCopyrightText: 2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
2// SPDX-FileContributor: Andrew Hayzen <andrew.hayzen@kdab.com>
3//
4// SPDX-License-Identifier: MIT OR Apache-2.0
5
6#[cxx::bridge]
7pub mod ffi {
8    unsafe extern "C++" {
9        include!("cxx-qt-lib/qset.h");
10        type QSet_i16 = crate::QSet<i16>;
11    }
12
13    unsafe extern "C++" {
14        #[rust_name = "cxx_clear"]
15        fn clear(self: &mut QSet_i16);
16        #[rust_name = "cxx_contains"]
17        fn contains(self: &QSet_i16, _: &i16) -> bool;
18        #[rust_name = "cxx_remove"]
19        fn remove(self: &mut QSet_i16, _: &i16) -> bool;
20    }
21
22    #[namespace = "rust::cxxqtlib1"]
23    unsafe extern "C++" {
24        include!("cxx-qt-lib/common.h");
25
26        #[rust_name = "qset_clone_i16"]
27        fn construct(_: &QSet_i16) -> QSet_i16;
28        #[rust_name = "qset_default_i16"]
29        fn construct() -> QSet_i16;
30        #[rust_name = "qset_drop_i16"]
31        fn drop(_: &mut QSet_i16);
32    }
33
34    #[namespace = "rust::cxxqtlib1::qset"]
35    unsafe extern "C++" {
36        #[rust_name = "get_unchecked_i16"]
37        #[allow(clippy::needless_lifetimes)]
38        unsafe fn qsetGetUnchecked<'a>(set: &'a QSet_i16, pos: isize) -> &'a i16;
39        #[rust_name = "insert_i16"]
40        fn qsetInsert(_: &mut QSet_i16, _: &i16);
41        #[rust_name = "len_i16"]
42        fn qsetLen(_: &QSet_i16) -> isize;
43    }
44}
45
46pub(crate) fn clone(s: &ffi::QSet_i16) -> ffi::QSet_i16 {
47    ffi::qset_clone_i16(s)
48}
49
50pub(crate) fn default() -> ffi::QSet_i16 {
51    ffi::qset_default_i16()
52}
53
54pub(crate) fn drop(s: &mut ffi::QSet_i16) {
55    ffi::qset_drop_i16(s);
56}
57
58pub(crate) unsafe fn get_unchecked(s: &ffi::QSet_i16, pos: isize) -> &i16 {
59    ffi::get_unchecked_i16(s, pos)
60}
61
62pub(crate) fn insert(s: &mut ffi::QSet_i16, value: &i16) {
63    ffi::insert_i16(s, value);
64}
65
66pub(crate) fn len(s: &ffi::QSet_i16) -> isize {
67    ffi::len_i16(s)
68}