| David Tolnay | 97c7210 | 2020-01-25 16:49:00 -0800 | [diff] [blame] | 1 | #pragma once |
| David Tolnay | e3e0a71 | 2020-02-23 00:18:57 -0800 | [diff] [blame] | 2 | #include "cxxbridge/cxxbridge.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 | 324437a | 2020-03-01 13:02:24 -0800 | [diff] [blame^] | 22 | cxxbridge::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 | 09dbe75 | 2020-03-01 13:00:40 -0800 | [diff] [blame] | 25 | cxxbridge::Str c_return_str(const Shared &shared); |
| David Tolnay | 5608216 | 2020-03-01 12:57:33 -0800 | [diff] [blame] | 26 | cxxbridge::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 | 324437a | 2020-03-01 13:02:24 -0800 | [diff] [blame^] | 31 | void c_take_box(cxxbridge::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 | 09dbe75 | 2020-03-01 13:00:40 -0800 | [diff] [blame] | 35 | void c_take_str(cxxbridge::Str s); |
| David Tolnay | 5608216 | 2020-03-01 12:57:33 -0800 | [diff] [blame] | 36 | void c_take_rust_string(cxxbridge::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 | 97c7210 | 2020-01-25 16:49:00 -0800 | [diff] [blame] | 39 | } // namespace tests |