Skip to content

An easy way to turn unsafe CStrings into Rust String types and back.

License

Notifications You must be signed in to change notification settings

selfup/stringer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

turn_into_pointer(string: String)  -> CString

Takes a Rust String type and returns a CString.

make_string

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

[dependencies]
stringer = "0.1.6"

In the file you need the functions

extern crate stringer;
use stringer::*;

Things to consider

Due to the nature of what this library is doing:

  • This code is unsafe
  • Use at your own risk

About

An easy way to turn unsafe CStrings into Rust String types and back.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages