1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
Portions Copyright 2019-2021 ZomboDB, LLC.
Portions Copyright 2021-2022 Technology Concepts & Design, Inc. <support@tcdi.com>
All rights reserved.
Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/
use pgx::prelude::*;
#[pg_extern]
fn extern_func() -> bool {
extern_func_impl::<u8>()
}
// This ensures that parameterized function compiles when it has `pg_guard` attached to it
#[pg_guard]
// Uncommenting the line below will make it fail to compile
// #[no_mangle]
extern "C" fn extern_func_impl<T>() -> bool {
true
}
// This ensures that non-parameterized function compiles when it has `pg_guard` attached to it
// and [no_mangle]
#[pg_guard]
#[no_mangle]
extern "C" fn extern_func_impl_1() -> bool {
true
}
// This ensures that lifetime-parameterized function compiles when it has `pg_guard` attached to it
// and [no_mangle]
#[pg_guard]
#[no_mangle]
extern "C" fn extern_func_impl_2<'a>() -> bool {
true
}
#[cfg(any(test, feature = "pg_test"))]
#[pg_schema]
mod tests {
#[allow(unused_imports)]
use crate as pgx_tests;
}