diff options
| author | Clar Charr <clar@charr.xyz> | 2017-04-05 17:13:46 -0400 |
|---|---|---|
| committer | Clar Charr <clar@charr.xyz> | 2017-04-07 15:19:02 -0400 |
| commit | 68909b0ec0d8738a8f1a0bb7a80998a246943471 (patch) | |
| tree | 5de6b5630c6bb1cf943276217a99e8893434cff7 /src/libstd/ffi | |
| parent | 44855a4cef3e83c76c386fdcf034447a8ee128e4 (diff) | |
Add as_c_str.
Diffstat (limited to 'src/libstd/ffi')
| -rw-r--r-- | src/libstd/ffi/c_str.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 2d14bb66bf4..d157d52259d 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -324,6 +324,12 @@ impl CString { &self.inner } + /// Extracts a `CStr` slice containing the entire string. + #[unstable(feature = "as_c_str", issue = "40380")] + pub fn as_c_str(&self) -> &CStr { + &*self + } + /// Converts this `CString` into a boxed `CStr`. #[unstable(feature = "into_boxed_c_str", issue = "40380")] pub fn into_boxed_c_str(self) -> Box<CStr> { |
