Skip to main content

libmqm_constants/
generated.rs

1#[cfg(feature = "generate")]
2#[rustfmt::skip]
3mod c {
4    #![allow(
5        non_upper_case_globals,
6        clippy::unreadable_literal,
7        clippy::needless_raw_string_hashes,
8        clippy::upper_case_acronyms,
9        clippy::wildcard_imports
10    )]
11
12    pub mod mapping {
13        // This file is generated during the build process
14        include!(concat!(env!("OUT_DIR"), "/mapping.rs"));
15    }
16    include!(concat!(env!("OUT_DIR"), "/new_types.rs"));
17}
18
19#[cfg(all(not(feature = "generate"), target_os = "windows", target_arch = "x86_64"))]
20#[rustfmt::skip]
21mod c {
22    #![allow(
23        non_upper_case_globals,
24        clippy::unreadable_literal,
25        clippy::needless_raw_string_hashes,
26        clippy::upper_case_acronyms,
27        clippy::wildcard_imports
28    )]
29
30    pub mod mapping {
31        include!("pregen/x86_64-windows-mapping.rs");
32    }
33    include!("pregen/x86_64-windows-new_types.rs");
34}
35
36#[cfg(all(not(feature = "generate"), target_os = "linux", target_arch = "x86_64"))]
37#[rustfmt::skip]
38mod c {
39    #![allow(
40        non_upper_case_globals,
41        clippy::unreadable_literal,
42        clippy::needless_raw_string_hashes,
43        clippy::upper_case_acronyms,
44        clippy::wildcard_imports
45    )]
46
47    pub mod mapping {
48        include!("pregen/x86_64-linux-mapping.rs");
49    }
50    include!("pregen/x86_64-linux-new_types.rs");
51}
52
53#[cfg(all(not(feature = "generate"), target_os = "linux", target_arch = "aarch64"))]
54#[rustfmt::skip]
55mod c {
56    #![allow(
57        non_upper_case_globals,
58        clippy::unreadable_literal,
59        clippy::needless_raw_string_hashes,
60        clippy::upper_case_acronyms,
61        clippy::wildcard_imports
62    )]
63
64    pub mod mapping {
65        include!("pregen/aarch64-linux-mapping.rs");
66    }
67    include!("pregen/aarch64-linux-new_types.rs");
68}
69
70#[cfg(all(not(feature = "generate"), target_os = "linux", target_arch = "powerpc64"))]
71#[rustfmt::skip]
72mod c {
73    #![allow(
74        non_upper_case_globals,
75        clippy::unreadable_literal,
76        clippy::needless_raw_string_hashes,
77        clippy::upper_case_acronyms,
78        clippy::wildcard_imports
79    )]
80
81    pub mod mapping {
82        include!("pregen/powerpc64-linux-mapping.rs");
83    }
84    include!("pregen/powerpc64-linux-new_types.rs");
85}
86
87#[cfg(all(not(feature = "generate"), target_os = "linux", target_arch = "s390x"))]
88#[rustfmt::skip]
89mod c {
90    #![allow(
91        non_upper_case_globals,
92        clippy::unreadable_literal,
93        clippy::needless_raw_string_hashes,
94        clippy::upper_case_acronyms,
95        clippy::wildcard_imports
96    )]
97
98    pub mod mapping {
99        include!("pregen/s390x-linux-mapping.rs");
100    }
101    include!("pregen/s390x-linux-new_types.rs");
102}
103
104#[cfg(all(not(feature = "generate"), target_os = "macos"))]
105mod c {
106    #![allow(
107        non_upper_case_globals,
108        clippy::unreadable_literal,
109        clippy::needless_raw_string_hashes,
110        clippy::upper_case_acronyms,
111        clippy::wildcard_imports
112    )]
113
114    pub mod mapping {
115        include!("pregen/any-macos-mapping.rs");
116    }
117    include!("pregen/any-macos-new_types.rs");
118}
119
120pub mod constants {
121    pub use super::c::constants::*;
122    use crate::types;
123    use libmqm_sys as mq;
124
125    pub const MQBA_FIRST: types::Selector = types::Selector(mq::MQBA_FIRST);
126    pub const MQBA_LAST: types::Selector = types::Selector(mq::MQBA_LAST);
127    pub const MQGA_FIRST: types::Selector = types::Selector(mq::MQGA_FIRST);
128    pub const MQGA_LAST: types::Selector = types::Selector(mq::MQGA_LAST);
129
130    #[cfg(feature = "mqai")]
131    mod mqai {
132        use crate::types;
133        use libmqm_sys::mqai;
134
135        pub const MQOA_FIRST: types::Selector = types::Selector(mqai::MQOA_FIRST);
136        pub const MQOA_LAST: types::Selector = types::Selector(mqai::MQOA_LAST);
137    }
138    #[cfg(feature = "mqai")]
139    pub use mqai::*;
140
141    #[cfg(feature = "pcf")]
142    mod pcf {
143        use crate::types;
144        use libmqm_sys::pcf;
145
146        pub const MQUA_FIRST: types::Selector = types::Selector(pcf::MQUA_FIRST);
147        pub const MQUA_LAST: types::Selector = types::Selector(pcf::MQUA_LAST);
148    }
149    #[cfg(feature = "pcf")]
150    pub use pcf::*;
151}
152
153pub mod mapping {
154    pub use super::c::mapping::*;
155
156    use crate::lookup::{BinarySearchSource, ConstSource, PhfSource};
157
158    type MqxaSource<'a> = ConstSource<BinarySearchSource<'a>, BinarySearchSource<'a>>;
159
160    pub const MQXA_MAPSTR: MqxaSource = ConstSource(MQIA_MAPSTR, MQCA_MAPSTR);
161    pub const MQRC_FULL_MAPSTR: ConstSource<PhfSource, PhfSource> = ConstSource(MQRC_MAPSTR, MQRCCF_MAPSTR);
162
163    pub struct SelectorLookup;
164}
165
166pub mod types {
167    use crate::value::{define_new_type, impl_value};
168    use ::libmqm_sys as mq;
169
170    pub use super::c::types::*;
171
172    define_new_type!(pub MQXA, mq::MQLONG, super::mapping::MQXA_MAPSTR, "Selectors for MQIA and MQCA");
173    impl_value!(MQXA, mq::MQLONG);
174    define_new_type!(pub MQRC, mq::MQLONG, super::mapping::MQRC_FULL_MAPSTR, "Reason Code from an MQ function call");
175    impl_value!(MQRC, mq::MQLONG);
176
177    define_new_type!(pub Selector, mq::MQLONG, super::mapping::SelectorLookup, "All Selectors including [`MQIA`], [`MQCA`], [`MQIACF`], [`MQCACF`], [`MQIACH`], [`MQCACH`], [`MQIASY`] and [`MQHA`]");
178    impl_value!(Selector, mq::MQLONG);
179}