blob: 1275c15fe5a86d64a2532a7e627107c52e60a222 [file] [edit]
// Part of the Crubit project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include <iostream>
// The generated bindings are in a header at the same path as the
// `example_crate` rust_library, with a `.h` suffix.
#include "support/rs_std/str_ref.h"
#include "examples/rust/std/example_crate.h"
#include "support/rs_std/rs_alloc.h"
int main(int argc, char* argv[]) {
rs::Result<rs::Option<rs::StrRef>, ::rs::alloc::string::String> result =
example_crate::returns_result(true);
if (result.has_value()) {
if (result->has_value()) {
std::cout << "ok: " << **result << std::endl;
} else {
std::cout << "ok: None" << std::endl;
}
} else {
std::cout << "err:" << result.error() << std::endl;
}
}