about summary refs log tree commit diff
path: root/src/libcore/convert.rs
AgeCommit message (Collapse)AuthorLines
2015-10-23Make `{Default, From, FromIterator, One, Zero}` well-formedAndrew Paseltiner-1/+1
Using these traits in an object context previously resulted in an RFC 1214 warning.
2015-06-17core: Split apart the global `core` featureAlex Crichton-4/+5
This commit shards the broad `core` feature of the libcore library into finer grained features. This split groups together similar APIs and enables tracking each API separately, giving a better sense of where each feature is within the stabilization process. A few minor APIs were deprecated along the way: * Iterator::reverse_in_place * marker::NoCopy
2015-05-12TRPL: Borrow and AsRefSteve Klabnik-0/+5
These two traits are commonly confused. As such, explain the difference. Fixes #24163
2015-05-10Add #[inline] to AsRef<str>::as_ref for String and str.Jan Bujak-0/+1
2015-04-26Make From::from example more idiomatic / simplerCorey Farwell-3/+1
2015-04-24Remove reference to 'to'Steve Klabnik-1/+1
FIxes #24712
2015-04-10Add examples for ConvertSteve Klabnik-5/+51
2015-04-04s/Perform/Performs/Andrew Paseltiner-4/+4
Per [RFC #0505](https://github.com/rust-lang/rfcs/blob/master/text/0505-api-comment-conventions.md#formatting).
2015-03-31Test fixes and rebase conflicts, round 2Alex Crichton-7/+0
2015-03-31rollup merge of #23879: seanmonstar/del-from-errorAlex Crichton-0/+7
Conflicts: src/libcore/error.rs
2015-03-31Stabilize `std::convert` and related codeAaron Turon-16/+22
* Marks `#[stable]` the contents of the `std::convert` module. * Added methods `PathBuf::as_path`, `OsString::as_os_str`, `String::as_str`, `Vec::{as_slice, as_mut_slice}`. * Deprecates `OsStr::from_str` in favor of a new, stable, and more general `OsStr::new`. * Adds unstable methods `OsString::from_bytes` and `OsStr::{to_bytes, to_cstring}` for ergonomic FFI usage. [breaking-change]
2015-03-30convert: remove FromError, use From<E> insteadSean McArthur-0/+7
This removes the FromError trait, since it can now be expressed using the new convert::Into trait. All implementations of FromError<E> where changed to From<E>, and `try!` was changed to use From::from instead. Because this removes FromError, it is a breaking change, but fixing it simply requires changing the words `FromError` to `From`, and `from_error` to `from`. [breaking-change]
2015-03-26Revise use of conversion traitsAaron Turon-0/+16
This commit revises `path` and `os_str` to use blanket impls for `From` on reference types. This both cuts down on the number of required impls, and means that you can pass through e.g. `T: AsRef<OsStr>` to `PathBuf::from` without an intermediate call to `as_ref`. It also makes a FIXME note for later generalizing the blanket impls for `AsRef` and `AsMut` to use `Deref`/`DerefMut`, once it is possible to do so.
2015-03-23Add generic conversion traitsAaron Turon-0/+113
This commit: * Introduces `std::convert`, providing an implementation of RFC 529. * Deprecates the `AsPath`, `AsOsStr`, and `IntoBytes` traits, all in favor of the corresponding generic conversion traits. Consequently, various IO APIs now take `AsRef<Path>` rather than `AsPath`, and so on. Since the types provided by `std` implement both traits, this should cause relatively little breakage. * Deprecates many `from_foo` constructors in favor of `from`. * Changes `PathBuf::new` to take no argument (creating an empty buffer, as per convention). The previous behavior is now available as `PathBuf::from`. * De-stabilizes `IntoCow`. It's not clear whether we need this separate trait. Closes #22751 Closes #14433 [breaking-change]