| David Tolnay | 97c7210 | 2020-01-25 16:49:00 -0800 | [diff] [blame] | 1 | #pragma once |
| David Tolnay | 736cbca | 2020-03-11 16:49:18 -0700 | [diff] [blame] | 2 | #include "rust/cxx.h" |
| David Tolnay | ad5b8af | 2020-01-26 16:59:13 -0800 | [diff] [blame] | 3 | #include <memory> |
| 4 | #include <string> |
| David Tolnay | 97c7210 | 2020-01-25 16:49:00 -0800 | [diff] [blame] | 5 | |
| 6 | namespace tests { |
| 7 | |
| David Tolnay | ad5b8af | 2020-01-26 16:59:13 -0800 | [diff] [blame] | 8 | struct R; |
| 9 | struct Shared; |
| 10 | |
| 11 | class C { |
| 12 | public: |
| 13 | C(size_t n); |
| David Tolnay | 3fd7f56 | 2020-01-26 17:47:11 -0800 | [diff] [blame] | 14 | size_t get() const; |
| David Tolnay | ad5b8af | 2020-01-26 16:59:13 -0800 | [diff] [blame] | 15 | |
| 16 | private: |
| 17 | size_t n; |
| 18 | }; |
| 19 | |
| 20 | size_t c_return_primitive(); |
| 21 | Shared c_return_shared(); |
| David Tolnay | 750755e | 2020-03-01 13:04:08 -0800 | [diff] [blame] | 22 | rust::Box<R> c_return_box(); |
| David Tolnay | ad5b8af | 2020-01-26 16:59:13 -0800 | [diff] [blame] | 23 | std::unique_ptr<C> c_return_unique_ptr(); |
| 24 | const size_t &c_return_ref(const Shared &shared); |
| David Tolnay | 750755e | 2020-03-01 13:04:08 -0800 | [diff] [blame] | 25 | rust::Str c_return_str(const Shared &shared); |
| 26 | rust::String c_return_rust_string(); |
| David Tolnay | ad5b8af | 2020-01-26 16:59:13 -0800 | [diff] [blame] | 27 | std::unique_ptr<std::string> c_return_unique_ptr_string(); |
| 28 | |
| 29 | void c_take_primitive(size_t n); |
| 30 | void c_take_shared(Shared shared); |
| David Tolnay | 750755e | 2020-03-01 13:04:08 -0800 | [diff] [blame] | 31 | void c_take_box(rust::Box<R> r); |
| David Tolnay | ad5b8af | 2020-01-26 16:59:13 -0800 | [diff] [blame] | 32 | void c_take_unique_ptr(std::unique_ptr<C> c); |
| 33 | void c_take_ref_r(const R &r); |
| 34 | void c_take_ref_c(const C &c); |
| David Tolnay | 750755e | 2020-03-01 13:04:08 -0800 | [diff] [blame] | 35 | void c_take_str(rust::Str s); |
| 36 | void c_take_rust_string(rust::String s); |
| David Tolnay | ad5b8af | 2020-01-26 16:59:13 -0800 | [diff] [blame] | 37 | void c_take_unique_ptr_string(std::unique_ptr<std::string> s); |
| 38 | |
| David Tolnay | ebef4a2 | 2020-03-17 15:33:47 -0700 | [diff] [blame] | 39 | void c_try_return_void(); |
| 40 | size_t c_try_return_primitive(); |
| 41 | size_t c_fail_return_primitive(); |
| David Tolnay | 9964262 | 2020-03-25 13:07:35 -0700 | [diff] [blame] | 42 | rust::Box<R> c_try_return_box(); |
| 43 | const rust::String &c_try_return_ref(const rust::String &); |
| 44 | rust::Str c_try_return_str(rust::Str); |
| 45 | rust::String c_try_return_rust_string(); |
| 46 | std::unique_ptr<std::string> c_try_return_unique_ptr_string(); |
| David Tolnay | ebef4a2 | 2020-03-17 15:33:47 -0700 | [diff] [blame] | 47 | |
| David Tolnay | 97c7210 | 2020-01-25 16:49:00 -0800 | [diff] [blame] | 48 | } // namespace tests |