File tree Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 1212- [ alloc_system] ( alloc-system.md )
1313- [ allocator] ( allocator.md )
1414- [ allow_internal_unstable] ( allow-internal-unstable.md )
15+ - [ as_c_str] ( as-c-str.md )
1516- [ as_unsafe_cell] ( as-unsafe-cell.md )
1617- [ ascii_ctype] ( ascii-ctype.md )
1718- [ asm] ( asm.md )
Original file line number Diff line number Diff line change 1+ # ` as_c_str `
2+
3+ The tracking issue for this feature is: [ #40380 ]
4+
5+ [ #40380 ] : https://github.com/rust-lang/rust/issues/40380
6+
7+ ------------------------
8+
Original file line number Diff line number Diff line change @@ -324,6 +324,12 @@ impl CString {
324324 & self . inner
325325 }
326326
327+ /// Extracts a `CStr` slice containing the entire string.
328+ #[ unstable( feature = "as_c_str" , issue = "40380" ) ]
329+ pub fn as_c_str ( & self ) -> & CStr {
330+ & * self
331+ }
332+
327333 /// Converts this `CString` into a boxed `CStr`.
328334 #[ unstable( feature = "into_boxed_c_str" , issue = "40380" ) ]
329335 pub fn into_boxed_c_str ( self ) -> Box < CStr > {
You can’t perform that action at this time.
0 commit comments