Stabilize std::borrow
This commit stabilizes `std::borrow`, making the following modifications to catch up the API with language changes: * It renames `BorrowFrom` to `Borrow`, as was originally intended (but blocked for technical reasons), and reorders the parameters accordingly. * It moves the type parameter of `ToOwned` to an associated type. This is somewhat less flexible, in that each borrowed type must have a unique owned type, but leads to a significant simplification for `Cow`. Flexibility can be regained by using newtyped slices, which is advisable for other reasons anyway. * It removes the owned type parameter from `Cow`, making the type much less verbose. * Deprecates the `is_owned` and `is_borrowed` predicates in favor of direct matching. The above API changes are relatively minor; the basic functionality remains the same, and essentially the whole module is now marked `#[stable]`. [breaking-change]
This commit is contained in:
parent
9bb3b3772d
commit
a99e698628
29 changed files with 753 additions and 407 deletions
|
@ -161,7 +161,6 @@ extern crate libc;
|
|||
// NB: These reexports are in the order they should be listed in rustdoc
|
||||
|
||||
pub use core::any;
|
||||
pub use core::borrow;
|
||||
pub use core::cell;
|
||||
pub use core::clone;
|
||||
#[cfg(not(test))] pub use core::cmp;
|
||||
|
@ -184,6 +183,7 @@ pub use core::error;
|
|||
#[cfg(not(test))] pub use alloc::boxed;
|
||||
pub use alloc::rc;
|
||||
|
||||
pub use core_collections::borrow;
|
||||
pub use core_collections::fmt;
|
||||
pub use core_collections::slice;
|
||||
pub use core_collections::str;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue