diff options
| author | bors <bors@rust-lang.org> | 2017-04-09 09:17:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-04-09 09:17:34 +0000 |
| commit | ebb10a6131834e14f0685ef399b531444d631e9c (patch) | |
| tree | 16a884068513cff9b9352a713c2aff7d74f3c15b /src/libstd/ffi | |
| parent | cff81da514068ea89e06d1a62357971d34094ea3 (diff) | |
| parent | 68909b0ec0d8738a8f1a0bb7a80998a246943471 (diff) | |
| download | rust-ebb10a6131834e14f0685ef399b531444d631e9c.tar.gz rust-ebb10a6131834e14f0685ef399b531444d631e9c.zip | |
Auto merge of #41095 - clarcharr:as_extras, r=alexcrichton
Add as_c_str Again, tying up some consistencies with `CString`.
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 fc1b9a97632..29f977ecd8c 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> { |
