Murarth
1bbc776446
Implement Rc
/Arc
conversions for string-like types
...
Provides the following conversion implementations:
* `From<`{`CString`,`&CStr`}`>` for {`Arc`,`Rc`}`<CStr>`
* `From<`{`OsString`,`&OsStr`}`>` for {`Arc`,`Rc`}`<OsStr>`
* `From<`{`PathBuf`,`&Path`}`>` for {`Arc`,`Rc`}`<Path>`
2017-11-25 22:13:11 -07:00
Alex Crichton
5c3fe111d4
std: Avoid use of libc
in portable modules
...
This commit removes usage of the `libc` crate in "portable" modules like
those at the top level and `sys_common`. Instead common types like `*mut
u8` or `u32` are used instead of `*mut c_void` or `c_int` as well as
switching to platform-specific functions like `sys::strlen` instead of
`libc::strlen`.
2017-11-09 07:56:44 -08:00
steveklabnik
f8f9005e57
Fix most rendering warnings from switching to CommonMark
2017-10-20 15:29:35 -04:00
kennytm
6c43bd3c83
Rollup merge of #44855 - federicomenaquintero:master, r=steveklabnik
...
Improved docs for CStr, CString, OsStr, OsString
This expands the documentation for those structs and their corresponding traits, per https://github.com/rust-lang/rust/issues/29354
2017-10-13 23:37:51 +08:00
Federico Mena Quintero
5fb8e3d829
ffi/mod.rs: Use only one space after a period ending a sentence
2017-10-11 17:57:56 -05:00
Federico Mena Quintero
c8e232dfe8
ffi/mod.rs: Keep the one-sentence summary at the beginning of the module
2017-10-11 17:55:01 -05:00
Federico Mena Quintero
026451093d
ffi/c_str.rs: Use only one space after a period ending a sentence
2017-10-11 17:53:13 -05:00
Federico Mena Quintero
a9a4ce6dcc
ffi/c_str.rs: Fix method/function confusion
...
Per https://github.com/rust-lang/rust/pull/44855#discussion_r144049179
2017-10-11 17:52:39 -05:00
Federico Mena Quintero
d5bdfbced6
ffi/c_str.rs: Make all descriptions have a single-sentence summary at the beginning
...
Per https://github.com/rust-lang/rust/pull/44855#discussion_r144048837
and subsequent ones.
2017-10-11 17:51:37 -05:00
Federico Mena Quintero
d989cd02b5
Fix broken links in documentation
2017-10-02 15:46:10 -05:00
Federico Mena Quintero
50505aadbd
Clarify the ffi module's toplevel docs, per @clarcharr's comments
2017-10-02 14:16:37 -05:00
Federico Mena Quintero
9854e836a3
Remove the implication that CString contains UTF-8 data.
2017-10-02 13:53:50 -05:00
Nikolai Vazquez
f1798d3c9a
Cast inner type in OsStr::bytes
...
The innermost type is not [u8] on all platforms but is assumed to have
the same memory layout as [u8] since this conversion was done via
mem::transmute before.
2017-09-30 10:01:41 -04:00
Nikolai Vazquez
627998e86f
Remove unused 'mem' import in 'os_str' module
2017-09-28 08:43:06 -04:00
Nikolai Vazquez
33eaa94f90
Remove mem::transmute used in OsStr conversions
2017-09-28 08:07:49 -04:00
Nikolai Vazquez
755fd29b60
Fix mutability error in CString::from_raw
2017-09-28 07:56:35 -04:00
Nikolai Vazquez
6d14512fd9
Remove mem::transmute used in CStr conversions
2017-09-28 00:51:38 -04:00
Federico Mena Quintero
4143422981
os_str: Fix too-long lines
2017-09-26 08:59:34 -05:00
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