-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2baf376
commit cb2e70e
Showing
10 changed files
with
69 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
src/cxxbridge_code/target | ||
build | ||
|
||
examples/src/cxxbridge_code/target | ||
examples/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include "cxxbridge_code/src/lib.rs.h" | ||
#include <iostream> | ||
#include <string> | ||
#include "rust/cxx.h" | ||
|
||
int main() | ||
{ | ||
// Primitive types: | ||
std::cout << "[1] A value given via generateb cxxbridge for lib_cxxbridge_bool: " | ||
<< lib_cxxbridge_bool(true) << std::endl; | ||
std::cout << "[2] A value given via generated cxxbridge for lib_cxxbridge_integer: " | ||
<< lib_cxxbridge_integer(86) << std::endl; | ||
const rust::String testString = "Max"; | ||
std::cout << "[3] A value given via generated cxxbridge for lib_cxxbridge_string: " | ||
<< lib_cxxbridge_string(testString) << std::endl; | ||
|
||
// Return Rust `Result` with Ok: | ||
std::cout << "[4] A Rust `Result Ok` value given via generated cxxbridge for lib_cxxbridge_return_result_ok:" << std::endl | ||
<< lib_cxxbridge_return_result_ok() << std::endl; | ||
|
||
// Return Rust `Result` with Error: | ||
try | ||
{ | ||
std::cout << "[5] A Rust `Result Error` value given via generated cxxbridge for lib_cxxbridge_return_result_error:" << std::endl | ||
<< lib_cxxbridge_return_result_error() << std::endl; | ||
} | ||
catch (rust::Error e) | ||
{ | ||
std::cerr << "Got an error from Rust function `Result`:" << std::endl; | ||
std::cerr << e.what() << std::endl; | ||
} | ||
|
||
// Panic in a function call: | ||
std::cout << "[6] Testing a case of panic by running lib_cxxbridge_panicked_function:" << std::endl; | ||
std::cout << lib_cxxbridge_panicked_function(); | ||
|
||
return 0; | ||
} |
This file was deleted.
Oops, something went wrong.