132 Commits

Author SHA1 Message Date
David Tolnay
219c0790d4
Generate data accessor for Vec 2020-04-25 18:02:15 -07:00
David Tolnay
cb80057051
Wire up Vec destructor 2020-04-25 18:02:14 -07:00
David Tolnay
0d3a7357fd
Remove unimplemented constructors from rust::Vec header 2020-04-25 18:02:14 -07:00
David Tolnay
465305bdb4
Add rust::Vec<T>::empty 2020-04-25 18:02:13 -07:00
David Tolnay
7f2dc3bab0
Reorder rust::Vec below Box 2020-04-25 18:02:13 -07:00
David Tolnay
9c6bf2d8ef
Remove assumption of Vec field order 2020-04-25 18:02:12 -07:00
David Tolnay
a9a7ed18e6
Remove rust::Vec<T>::operator std::vector<T> 2020-04-25 18:02:08 -07:00
David Tolnay
507c2d75cf
Merge pull request #67 from myronahn/master
C++ std::vector<T> and Rust std::vec::Vec<T> support
2020-04-25 18:01:54 -07:00
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 c2279000a926db64c0bb0caa69025031174d576a
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