#pragma once #include "rust/cxx.h" #include #include struct CxxSerial { CxxSerial(rust::String port, uint32_t baud, uint32_t read_timeout, uint32_t write_timeout, bool hardware); uint32_t write(const rust::Vec &data) const; uint32_t read(rust::Vec &data) const; void flush() const; bool check() const; private: struct impl; std::shared_ptr impl; }; // port: String, baud: u32, timeout: u32, hardware: bool std::unique_ptr new_cxx_serial(rust::String port, uint32_t baud, uint32_t read_timeout, uint32_t write_timeout, bool hardware);