about summary refs log tree commit diff
path: root/src/libstd/prelude
diff options
context:
space:
mode:
authorAaron Turon <aturon@mozilla.com>2015-03-18 09:14:54 -0700
committerAaron Turon <aturon@mozilla.com>2015-03-23 15:01:45 -0700
commit8389253df0431e58bfe0a8e0e3949d58ebe7400f (patch)
tree816e989b62f4c6b9fb6dc8ea199fe3c2538d2a80 /src/libstd/prelude
parentb0aad7dd4fad8d7e2e2f877a511a637258949597 (diff)
Add generic conversion traits
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]
Diffstat (limited to 'src/libstd/prelude')
-rw-r--r--src/libstd/prelude/v1.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstd/prelude/v1.rs b/src/libstd/prelude/v1.rs
index a0b4c80e9f3..6e12ac1a226 100644
--- a/src/libstd/prelude/v1.rs
+++ b/src/libstd/prelude/v1.rs
@@ -29,6 +29,8 @@
 #[doc(no_inline)] pub use clone::Clone;
 #[stable(feature = "rust1", since = "1.0.0")]
 #[doc(no_inline)] pub use cmp::{PartialEq, PartialOrd, Eq, Ord};
+#[unstable(feature = "convert")]
+#[doc(no_inline)] pub use convert::{AsRef, AsMut, Into, From};
 #[stable(feature = "rust1", since = "1.0.0")]
 #[doc(no_inline)] pub use iter::DoubleEndedIterator;
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -40,8 +42,10 @@
 #[stable(feature = "rust1", since = "1.0.0")]
 #[doc(no_inline)] pub use result::Result::{self, Ok, Err};
 #[stable(feature = "rust1", since = "1.0.0")]
+#[allow(deprecated)]
 #[doc(no_inline)] pub use slice::{SliceConcatExt, AsSlice};
 #[stable(feature = "rust1", since = "1.0.0")]
+#[allow(deprecated)]
 #[doc(no_inline)] pub use str::Str;
 #[stable(feature = "rust1", since = "1.0.0")]
 #[doc(no_inline)] pub use string::{String, ToString};