David Tolnay
7c29546739
Revert some unrelated changes from PR 67
2020-04-25 13:13:43 -07:00
David Tolnay
37dd7e1174
Format with clang-format
2020-04-25 12:51:59 -07:00
Myron Ahn
eba35cfce7
C++ std::vector<T> and Rust std::vec::Vec<T> support
...
Add basic std::vector and std::vec::Vec support across FFI boundary.
2020-04-25 12:47:04 -07:00
David Tolnay
9706a5104c
Express Box const_pointer and pointer more concisely
2020-04-24 17:09:01 -07:00
David Tolnay
e710af1dd7
Fix typo in Slice repr comment
2020-04-14 16:42:06 -07:00
David Tolnay
efe81052e7
Touch up &[u8] PR
2020-04-14 16:42:06 -07:00
David Tolnay
eb952bac14
Format with rustfmt and clang-format
2020-04-14 16:42:06 -07:00
Adrian Taylor
f5dd552036
Adding &[u8] support.
...
This change adds specifically, support for &[u8] with a corresponding
rust::Slice<uint8_t> type. No other types of slice are permitted. The
rationale is that it may be common to pass binary data back and forth
across the FFI boundary, so it's more urgent to get this in place sooner.
Broader support for other slices can wait for the future.
But, both C++ and Rust-side bindings should allow the existing support
to be broadened to other Slice types in future without code changes.
A few specific notes:
* The name "rust::Slice" might be better as "rust::SliceRef" but I'm
following the precedent of "rust::Str".
* It would be good to add constructors from std::span but as that's
a C++20 feature, that may have to wait until C++ feature detection
is resolved.
* Internally, this follows the pattern of &str, where the parser will
initially recognize this as Type::Ref (of Type::Slice) but then
will replace that with Type::SliceRefU8. Type::Slice should not
persist through later stages. As we later come to support other
types of slice, we would probably want to remove Type::SliceRefU8.
2020-04-14 14:13:48 -07:00
David Tolnay
f262d38671
AlwaysBreakTemplateDeclarations: true
...
I felt that the clangfmt changes in c2279000a9
were not making the code better.
2020-04-11 22:14:44 -07:00
David Tolnay
c2279000a9
Format with clangfmt
2020-04-11 22:06:00 -07:00
David Tolnay
7db7dade24
Make it explicit when going from T to Box<T>
2020-04-11 14:12:49 -07:00
David Tolnay
7ce59fc9e8
Add in_place constructor for Box
2020-04-11 11:53:29 -07:00
David Tolnay
47b3cf2283
Add constructor to move T into Box
2020-04-11 00:54:39 -07:00
David Tolnay
59b5ba1f14
Include BaseTsd.h to get SSIZE_T
2020-04-10 11:36:08 -07:00
David Tolnay
b8a6fb2755
Define rust::isize with Windows support
2020-04-10 11:17:28 -07:00
David Tolnay
533d458b43
Fill in missing const on Fn member functions
2020-04-08 20:36:13 -07:00
David Tolnay
a23129c069
Allow calling fn pointers with explicit indirect call syntax
2020-04-08 20:08:28 -07:00
David Tolnay
75dca2e846
Passing function pointer from Rust to C++
2020-03-29 21:50:25 -07:00
David Tolnay
30430f13c9
Include <cstddef> for size_t
2020-03-19 20:49:34 -07:00
David Tolnay
4791f1c115
Include <utility> when using std::move
2020-03-17 21:55:19 -07:00
David Tolnay
b7a7cb6785
Provide more struct definitions where needed
2020-03-17 21:40:47 -07:00
David Tolnay
1e548174c3
Implement fallible Rust functions
2020-03-17 00:15:48 -07:00
David Tolnay
8c7304998e
Bump inline namespace to match minor version
2020-03-13 01:29:23 -07:00
David Tolnay
736cbcad40
Move header include path to rust/cxx.h
2020-03-11 16:51:38 -07:00
David Tolnay
33169bdd59
Safe to assume more about the Box representation
...
https://doc.rust-lang.org/std/boxed/index.html :
So long as T: Sized, a Box<T> is guaranteed to be represented as a
single pointer and is also ABI-compatible with C pointers (i.e. the C
type T*).
2020-03-06 13:10:58 -08:00
David Tolnay
d1e2efc847
Begin to introduce Rust-style move for C++ objects
2020-03-06 10:25:50 -08:00
David Tolnay
4590d2af81
Delete unused get_raw member from Box
2020-03-02 00:03:25 -08:00
David Tolnay
851677c4cc
Remove insignificant parameter names from header
2020-03-01 23:49:46 -08:00
David Tolnay
2248c3064e
Write Box internals in terms of type aliases
2020-03-01 21:13:32 -08:00
David Tolnay
9f9213709d
Backport type aliases to c++11
2020-03-01 21:09:40 -08:00
David Tolnay
f6292378c7
Add rust::Box member type aliases
2020-03-01 21:09:11 -08:00
David Tolnay
d9c4ac955f
Organize string constructors
2020-03-01 20:36:21 -08:00
David Tolnay
baae443ae2
Change Str to Repr operator to explicit
2020-03-01 20:20:10 -08:00
David Tolnay
404d689e95
Change string cast operators to explicit
2020-03-01 20:19:41 -08:00
David Tolnay
001102af71
Use iosfwd for forward declared ostream insertion operators
2020-03-01 20:05:04 -08:00
David Tolnay
3b0c988059
Expose snake case type aliases
2020-03-01 14:08:57 -08:00
David Tolnay
69fe4c25ec
Format with clang-format
2020-03-01 14:05:01 -08:00
David Tolnay
750755e557
Rename namespace to rust::inline cxxbridge01
2020-03-01 13:47:29 -08:00
David Tolnay
324437a263
Rename C++ RustBox to Box
2020-03-01 13:47:29 -08:00
David Tolnay
09dbe75a5d
Rename C++ RustStr to Str
2020-03-01 13:47:28 -08:00
David Tolnay
5608216979
Rename C++ RustString to String
2020-03-01 13:47:28 -08:00
David Tolnay
649337e12d
Move namespace alias to top of header for visibility
2020-02-25 18:11:20 -08:00
David Tolnay
908385887b
Protect from ADL in Box construction and assignment
2020-02-23 00:57:03 -08:00
David Tolnay
e43b737f2c
Release 0.1.0
2020-01-08 08:57:24 -08:00
David Tolnay
7db7369797
Safe FFI between Rust and C++
2020-01-08 08:57:24 -08:00