Lines Matching +full:rust +full:- +full:src
2 …src="https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github"…
5 # CXX — safe interop between Rust and C++
7 This library provides a safe mechanism for calling C++ code from Rust and Rust
8 code from C++. It carves out a regime of commonality where Rust and C++ are
12 interface over unsafe C-style signatures.
19 of the types and function signatures to protect both Rust's and C++'s
34 In this example we are writing a Rust application that calls a C++ client of a
35 large-file blobstore service. The blobstore supports a `put` operation for a
40 ```rust,noplayground
43 extern "Rust" {
46 fn next_chunk(buf: &mut MultiBuf) -> &[u8];
54 fn new_blobstore_client() -> UniquePtr<BlobstoreClient>;
55 fn put(self: &BlobstoreClient, buf: &mut MultiBuf) -> Result<u64>;
60 Now we simply provide Rust definitions of all the things in the `extern "Rust"`
65 this blobstore example in full detail, including all of the Rust code and all of
70 - [demo/src/main.rs](https://github.com/dtolnay/cxx/blob/master/demo/src/main.rs)
71 - [demo/include/blobstore.h](https://github.com/dtolnay/cxx/blob/master/demo/include/blobstore.h)
72 - [demo/src/blobstore.cc](https://github.com/dtolnay/cxx/blob/master/demo/src/blobstore.cc)
74 The key takeaway, which is enabled by the CXX library, is that the Rust code in
75 main.rs is 100% ordinary safe Rust code working idiomatically with Rust types
77 idiomatically with C++ types. The Rust code feels like Rust and the C++ code
78 feels like C++, not like C-style "FFI glue".