Add more helpful Rust Configuration methods
Also switch where they're attached so they can be used with both
versions of Configuration we have in Rust.
Signed-off-by: Brian Silverman <bsilver16384@gmail.com>
Change-Id: I944cd0fc05db460573e9df694e812bdf0f31ffd7
diff --git a/aos/configuration_for_rust.cc b/aos/configuration_for_rust.cc
index 3c3daad..64d070f 100644
--- a/aos/configuration_for_rust.cc
+++ b/aos/configuration_for_rust.cc
@@ -12,13 +12,18 @@
RustStrToStringView(application_name), node);
}
+const Node *GetNodeForRust(const Configuration *config, rust::Str name) {
+ return GetNode(config, RustStrToStringView(name));
+}
+
rust::Vec<uint8_t> MaybeReadConfigForRust(
rust::Str path, rust::Slice<const rust::Str> extra_import_paths) {
std::vector<std::string_view> cc_extra_import_paths;
for (const rust::Str &extra_import_path : extra_import_paths) {
cc_extra_import_paths.push_back(RustStrToStringView(extra_import_path));
}
- const auto cc_result = MaybeReadConfig(RustStrToStringView(path));
+ const auto cc_result =
+ MaybeReadConfig(RustStrToStringView(path), cc_extra_import_paths);
rust::Vec<uint8_t> result;
if (cc_result) {
result.reserve(cc_result->span().size());