blob: 388a85455d3070958aba7beb3c18978be48c3557 [file] [log] [blame]
Brian Silverman7edd1ce2022-07-23 16:10:54 -07001#ifndef AOS_FOR_RUST_H_
2#define AOS_FOR_RUST_H_
3
4// This file has some shared utilities for the for_rust C++ code, which provides
5// autocxx-friendly versions of C++ APIs.
6
7#include <string_view>
8
9#include "cxx.h"
10
11namespace aos {
12
13inline rust::Str StringViewToRustStr(std::string_view s) {
14 return rust::Str(s.data(), s.size());
15}
16
17inline std::string_view RustStrToStringView(rust::Str s) {
18 return std::string_view(s.data(), s.size());
19}
20
21} // namespace aos
22
23#endif // AOS_FOR_RUST_H_