Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/selfup/stringer
An easy way to turn unsafe CStrings into Rust String types and back.
https://github.com/selfup/stringer
Last synced: about 1 month ago
JSON representation
An easy way to turn unsafe CStrings into Rust String types and back.
- Host: GitHub
- URL: https://github.com/selfup/stringer
- Owner: selfup
- License: mit
- Created: 2016-05-29T03:51:30.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-07-05T02:23:11.000Z (over 8 years ago)
- Last Synced: 2024-11-13T22:24:44.709Z (about 1 month ago)
- Language: Rust
- Homepage: https://crates.io/crates/stringer
- Size: 10.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Stringer
An easy way to turn an unsafe `*const c_char` into a Rust String type and return a pointer for FFI.
## Functions
### turn_into_pointer
```rust
turn_into_pointer(string: String) -> CString
```
Takes a Rust String type and returns a CString.
#
### make_string
```rust
make_string(unsafe_string: *const c_char) -> String
```
Takes a `*const c_char` and returns a Rust `String` type.
#
### Example on how to load this into your project:**Cargo.toml**
```rust
[dependencies]
stringer = "0.1.6"
```**In the file you need the functions**
```rust
extern crate stringer;
use stringer::*;
```
### Things to considerDue to the nature of what this library is doing:
* This code is unsafe
* Use at your own risk