commit 7eda67802a3bf4c80cd6f9ef3d49a0f525930ab9
parent dbd76db6dd8cabd34d8e4e6ea8754c539a21e795
Author: MTRNord <mtrnord1@gmail.com>
Date: Wed, 14 Oct 2020 17:42:14 +0200
chore: Add README and small helper to write into mutable c char pointers
Diffstat:
3 files changed, 155 insertions(+), 2 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
@@ -9,4 +9,5 @@ bindgen = "0.55"
[dependencies]
enum-primitive-derive = "^0.1"
-num-traits = "^0.1"
-\ No newline at end of file
+num-traits = "^0.1"
+anyhow = "1.0"
+\ No newline at end of file
diff --git a/README.md b/README.md
@@ -0,0 +1,142 @@
+<!--
+*** Thanks for checking out this README Template. If you have a suggestion that would
+*** make this better, please fork the repo and create a pull request or simply open
+*** an issue with the tag "enhancement".
+*** Thanks again! Now go create something AMAZING! :D
+***
+***
+***
+*** To avoid retyping too much info. Do a search and replace for the following:
+*** github_username, repo_name, twitter_handle, email
+-->
+
+
+
+
+
+<!-- PROJECT SHIELDS -->
+<!--
+*** I'm using markdown "reference style" links for readability.
+*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
+*** See the bottom of this document for the declaration of the reference variables
+*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
+*** https://www.markdownguide.org/basic-syntax/#reference-style-links
+-->
+[![Contributors][contributors-shield]][contributors-url]
+[![Forks][forks-shield]][forks-url]
+[![Stargazers][stars-shield]][stars-url]
+[![Issues][issues-shield]][issues-url]
+[![MIT License][license-shield]][license-url]
+
+
+
+<!-- PROJECT LOGO -->
+<br />
+<p align="center">
+ <h3 align="center">YOUR_TITLE</h3>
+
+ <p align="center">
+ YOUR_SHORT_DESCRIPTION
+ <br />
+ <a href="https://github.com/MTRNord/xplane11-sys"><strong>Explore the docs »</strong></a>
+ <br />
+ <br />
+ <a href="https://github.com/MTRNord/xplane11-sys">View Demo</a>
+ ·
+ <a href="https://github.com/MTRNord/xplane11-sys/issues">Report Bug</a>
+ ·
+ <a href="https://github.com/MTRNord/xplane11-sys/issues">Request Feature</a>
+ </p>
+</p>
+
+
+
+<!-- TABLE OF CONTENTS -->
+## Table of Contents
+
+* [About the Project](#about-the-project)
+ * [Built With](#built-with)
+* [Getting Started](#getting-started)
+* [Roadmap](#roadmap)
+* [Contributing](#contributing)
+* [License](#license)
+* [Contact](#contact)
+* [Acknowledgements](#acknowledgements)
+
+
+
+<!-- ABOUT THE PROJECT -->
+## About The Project
+
+### Built With
+
+* [Rust](https://www.rust-lang.org/)
+* [Rust-Bindgen](https://github.com/rust-lang/rust-bindgen)
+* [Xplane11 SDK](https://developer.x-plane.com/sdk/)
+
+
+
+<!-- GETTING STARTED -->
+## Getting Started
+
+TODO: Link to example repo
+
+
+
+<!-- ROADMAP -->
+## Roadmap
+
+See the [open issues](https://github.com/MTRNord/xplane11-sys/issues) for a list of proposed features (and known issues).
+
+
+
+<!-- CONTRIBUTING -->
+## Contributing
+
+Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
+
+1. Fork the Project
+2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
+3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
+4. Push to the Branch (`git push origin feature/AmazingFeature`)
+5. Open a Pull Request
+
+
+
+<!-- LICENSE -->
+## License
+
+Distributed under the MIT License. See `LICENSE` for more information.
+
+
+
+<!-- CONTACT -->
+## Contact
+
+MTRNord - [@mtrnord](https://twitter.com/mtrnord) - [Xplane Forum](https://forums.x-plane.org/index.php?/profile/997689-mtrnord/) - [Matrix: @mtrnord:nordgedanken.dev](https://matrix.to/#/@mtrnord:nordgedanken.dev) - info[at]nordgedanken.de
+
+Project Link: [https://github.com/MTRNord/xplane11-sys](https://github.com/MTRNord/xplane11-sys)
+
+
+
+<!-- ACKNOWLEDGEMENTS -->
+## Acknowledgements
+
+* Xplane Team
+* Rust Bindgen Team
+
+
+
+
+<!-- MARKDOWN LINKS & IMAGES -->
+<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
+[contributors-shield]: https://img.shields.io/github/contributors/MTRNord/xplane11-sys.svg?style=flat-square
+[contributors-url]: https://github.com/MTRNord/xplane11-sys/graphs/contributors
+[forks-shield]: https://img.shields.io/github/forks/MTRNord/xplane11-sys.svg?style=flat-square
+[forks-url]: https://github.com/MTRNord/xplane11-sys/network/members
+[stars-shield]: https://img.shields.io/github/stars/MTRNord/xplane11-sys.svg?style=flat-square
+[stars-url]: https://github.com/MTRNord/xplane11-sys/stargazers
+[issues-shield]: https://img.shields.io/github/issues/MTRNord/xplane11-sys.svg?style=flat-square
+[issues-url]: https://github.com/MTRNord/xplane11-sys/issues
+[license-shield]: https://img.shields.io/github/license/MTRNord/xplane11-sys.svg?style=flat-square
+[license-url]: https://github.com/MTRNord/xplane11-sys/blob/master/LICENSE.txt
diff --git a/src/utils.rs b/src/utils.rs
@@ -31,3 +31,12 @@ pub mod log {
}
}
}
+
+use std::ffi::CString;
+pub fn write_c_char(string: &str, ptr: *mut ::std::os::raw::c_char) -> anyhow::Result<()> {
+ let c_str = CString::new(string)?;
+ unsafe {
+ std::ptr::copy_nonoverlapping(c_str.as_ptr(), ptr, c_str.as_bytes_with_nul().len());
+ }
+ Ok(())
+}
+\ No newline at end of file