Make C++ flags available in Rust.

In order to do this, we automagically grab all of C++ gflags and
add them into the Rust Clap command. We then pass through the flags
back to C++ to set them.

This requires different versions of clap to make both our implementation
and autocxx happy.

Change-Id: I36a9584de2ade55390f7109889996bad6e2cd071
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/init_for_rust.h b/aos/init_for_rust.h
new file mode 100644
index 0000000..86bfd66
--- /dev/null
+++ b/aos/init_for_rust.h
@@ -0,0 +1,47 @@
+#ifndef AOS_INIT_FOR_RUST_H_
+#define AOS_INIT_FOR_RUST_H_
+
+#include <string>
+#include <string_view>
+#include <vector>
+
+#include "aos/for_rust.h"
+#include "cxx.h"
+
+namespace aos {
+
+struct FlagInfo {
+  std::string name_;
+  std::string type_;
+  std::string description_;
+  std::string default_value_;
+  std::string filename_;
+
+  rust::Str name() const {
+    return StringViewToRustStr(std::string_view(name_));
+  }
+  rust::Str ty() const { return StringViewToRustStr(std::string_view(type_)); }
+  rust::Str description() const {
+    return StringViewToRustStr(std::string_view(description_));
+  }
+  rust::Str default_value() const {
+    return StringViewToRustStr(std::string_view(default_value_));
+  }
+  rust::Str filename() const {
+    return StringViewToRustStr(std::string_view(filename_));
+  }
+};
+
+// A special initialization function that initializes the C++ parts in a way
+// compatible with Rust. This requires careful coordination with `:init_rs`, do
+// not use it from anywhere else.
+void InitFromRust(const char *argv0);
+
+std::vector<FlagInfo> GetCppFlags();
+
+bool SetCommandLineOption(const char *name, const char *value);
+std::string GetCommandLineOption(const char *name);
+
+}  // namespace aos
+
+#endif  // AOS_INIT_FOR_RUST_H_