214 Commits

Author SHA1 Message Date
Federico Mena Quintero
91f6445b59 Overhaul the documentation for OsString / OsStr 2017-09-25 20:45:38 -05:00
Federico Mena Quintero
155b4b1c5f Module overview for std::os::windows:ffi 2017-09-25 20:45:38 -05:00
Federico Mena Quintero
3c5e18f322 Point from the error structs back to the method that created them, like in iterators 2017-09-25 13:51:48 -05:00
Federico Mena Quintero
2cb2a0606a Overhaul the ffi::CStr documentation. 2017-09-25 13:51:48 -05:00
Federico Mena Quintero
8da694a421 Overhaul the ffi::CString docs
Explain the struct's reason for being, and its most common usage
patterns.  Add a bunch of links.

Clarify the method docs a bit.

Part of https://github.com/rust-lang/rust/issues/29354
2017-09-25 13:51:48 -05:00
Federico Mena Quintero
5451b722b0 Expand the introduction to the ffi module.
We describe the representation of C strings, and the purpose of
OsString/OsStr.

Part of https://github.com/rust-lang/rust/issues/29354
2017-09-25 13:51:47 -05:00
Eduard-Mihai Burtescu
10f66bd6e4 Use rvalue promotion to 'static instead of static items. 2017-09-10 11:20:27 +03:00
Fourchaux
c7104be1a3 Fix typos & us spellings 2017-08-15 21:56:30 +02:00
Alex Crichton
16707d4348 std: Stabilize the str_{mut,box}_extras feature
Stabilizes

* `<&mut str>::as_bytes_mut`
* `<Box<str>>::into_boxed_bytes`
* `std::str::from_boxed_utf8_unchecked`
* `std::str::from_utf8_mut`
* `std::str::from_utf8_unchecked_mut`

Closes #41119
2017-07-25 07:10:42 -07:00
Alex Crichton
cbfce40e1c std: Stabilize CString/OsString/PathBuf extra methods
Stabilizes:

* `CString::as_c_str`
* `CString::into_boxed_c_str`
* `CStr::into_c_string`
* `OsString::into_boxed_os_str`
* `OsStr::into_os_string`
* `PathBuf::into_boxed_path`
* `PathBuf::into_path_buf`

Closes #40380
2017-07-25 07:09:31 -07:00
Mark Simulacrum
32cbbffea2 Rollup merge of #42227 - ollie27:into_to_from, r=aturon
Convert Intos to Froms.

This is a resubmission of #42129 without `impl<T> From<Vec<T>> for Box<[T]>`.
2017-07-04 07:41:33 -06:00
bors
c16930762a Auto merge of #42745 - sfackler:1.19-stabilization, r=alexcrichton
1.19 stabilization

r? @alexcrichton
2017-06-28 11:55:37 +00:00
Casey Rodarmor
0d985c9e87 Reword OsStr docs to clarify that utf8 may contain nulls 2017-06-25 14:23:43 -07:00
Steven Fackler
ea4fb8ee27 Stabilize OsString::shrink_to_fit
Closes #40421
2017-06-24 19:19:26 -07:00
Oliver Middleton
0d885efe16 Update version numbers for From impls 2017-06-21 01:18:19 +01:00
Clar Charr
5a97036b69 Convert Intos to Froms. 2017-06-21 01:18:18 +01:00
Corey Farwell
93abc2f877 Add doc example for CString::from_raw. 2017-06-20 13:49:42 -04:00
Corey Farwell
d3c26fe7e3 Add doc example for FromBytesWithNulError. 2017-06-20 13:49:42 -04:00
Corey Farwell
4797d8446c Add doc example for NulError. 2017-06-20 13:49:42 -04:00
Corey Farwell
e52d2f2ad0 Add doc example for CStr::to_str. 2017-06-20 13:49:42 -04:00
Corey Farwell
0962394b84 Add doc example for CString::as_c_str. 2017-06-20 13:49:42 -04:00
Corey Farwell
65793b30d3 Add doc example for Box<CStr>::into_c_string. 2017-06-20 13:49:27 -04:00
Corey Farwell
db97145150 Add doc example for CString::into_boxed_c_str. 2017-06-20 13:49:27 -04:00
Corey Farwell
82ba871c70 Add doc example for CStr::to_string_lossy. 2017-06-20 13:49:27 -04:00
Corey Farwell
5d71e8cd7e Add error scenario doc examples for CStr::from_bytes_with_nul. 2017-06-20 13:49:27 -04:00
Corey Farwell
7f687f8602 Add doc example for CStr::to_bytes_with_nul. 2017-06-20 13:49:27 -04:00
Corey Farwell
0fad2e038a Add doc example for CStr::to_bytes. 2017-06-20 13:49:10 -04:00
Alexander Bulaev
bcb5b13b85 Mark smaller CStr and CString functions as #[inline] 2017-06-20 11:18:52 +03:00
Stepan Koltsov
ac96fd7787 Avoid allocations in Debug for os_str
Fixes #38879
2017-06-15 20:42:37 +01:00
Corey Farwell
06f63f5edb Add doc example for CString::as_bytes. 2017-06-05 23:50:49 -04:00
Corey Farwell
ae4832d48a Add doc example for CString::as_bytes_with_nul. 2017-06-05 23:49:52 -04:00
Corey Farwell
815c12a765 Add doc example for CString::into_bytes_with_nul. 2017-06-05 23:48:13 -04:00
Corey Farwell
3ec1f61acc Add doc example for CString::into_bytes. 2017-06-05 23:46:44 -04:00
Corey Farwell
4db8c9f0ba Add doc example for CString::into_raw. 2017-06-05 23:43:25 -04:00
Guillaume Gomez
55c3f0b12e Add missing urls for OsStr docs 2017-05-24 19:33:40 +02:00
Guillaume Gomez
819acb5141 Add missing links for CStr and CString 2017-05-22 23:23:27 +02:00
Clar Charr
6119f9856c Remove unused lifetimes. 2017-05-20 15:32:11 -04:00
Oliver Middleton
2f703e4304 Correct some stability versions
These were found by running tidy on stable versions of rust and finding
features stabilised with the wrong version numbers.
2017-05-20 08:38:39 +01:00
Matt Brubeck
defcfb21f1 Remove wrong or outdated info from CString docs. 2017-05-09 10:55:47 -07:00
Scott McMurray
295bcdb715 Override ToOwned::clone_into for Path and OsStr
The only non-overridden one remaining is the CStr impl, which cannot
be optimized as doing so would break CString's second invariant.
2017-04-18 21:02:18 -07:00
bors
ebb10a6131 Auto merge of #41095 - clarcharr:as_extras, r=alexcrichton
Add as_c_str

Again, tying up some consistencies with `CString`.
2017-04-09 09:17:34 +00:00
Clar Charr
68909b0ec0 Add as_c_str. 2017-04-07 15:19:02 -04:00
Clar Charr
9ffb54568c Remove some CStr transmutes. 2017-04-06 17:42:02 -04:00
Corey Farwell
bc6eecd0c2 Merge branch 'master' into frewsxcv-osstr 2017-03-16 21:56:52 -04:00
bors
71d7b29475 Auto merge of #40009 - clarcharr:box_to_buf, r=alexcrichton
Leftovers from #39594; From<Box> impls

These are a few more impls that follow the same reasoning as those from #39594.

What's included:
* `From<Box<str>> for String`
* `From<Box<[T]>> for Vec<T>`
* `From<Box<CStr>> for CString`
* `From<Box<OsStr>> for OsString`
* `From<Box<Path>> for PathBuf`
* `Into<Box<str>> for String`
* `Into<Box<[T]>> for Vec<T>`
* `Into<Box<CStr>> for CString`
* `Into<Box<OsStr>> for OsString`
* `Into<Box<Path>> for PathBuf`
* `<Box<CStr>>::into_c_string`
* `<Box<OsStr>>::into_os_string`
* `<Box<Path>>::into_path_buf`
* Tracking issue for latter three methods + three from previous PR.

Currently, the opposite direction isn't doable with `From` (only `Into`) because of the separation between `liballoc` and `libcollections`. I'm holding off on those for a later PR.
2017-03-15 04:24:10 +00:00
Corey Farwell
6adbbfc6ba Add doc example for OsString::into_boxed_os_str. 2017-03-14 09:30:18 -04:00
Corey Farwell
bda57dbc05 Add doc example for OsString::shrink_to_fit. 2017-03-14 09:30:00 -04:00
Corey Farwell
5537955b17 Add doc example for OsString::reserve_exact. 2017-03-14 09:29:38 -04:00
Corey Farwell
4d57d92f07 Add doc example for OsString::reserve. 2017-03-14 09:29:09 -04:00
Corey Farwell
9a7b789c37 Add doc example for OsStr::to_os_string. 2017-03-14 09:28:30 -04:00