Add a tracking issue for btree_set_entry
This commit is contained in:
parent
b0f8bd7438
commit
82b8ea8a7a
2 changed files with 20 additions and 20 deletions
|
|
@ -15,7 +15,7 @@ use crate::vec::Vec;
|
|||
|
||||
mod entry;
|
||||
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
pub use self::entry::{Entry, OccupiedEntry, VacantEntry};
|
||||
|
||||
/// An ordered set based on a B-Tree.
|
||||
|
|
@ -950,7 +950,7 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {
|
|||
/// assert_eq!(set.len(), 4); // 100 was inserted
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
pub fn get_or_insert(&mut self, value: T) -> &T
|
||||
where
|
||||
T: Ord,
|
||||
|
|
@ -979,7 +979,7 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {
|
|||
/// assert_eq!(set.len(), 4); // a new "fish" was inserted
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
pub fn get_or_insert_with<Q: ?Sized, F>(&mut self, value: &Q, f: F) -> &T
|
||||
where
|
||||
T: Borrow<Q> + Ord,
|
||||
|
|
@ -995,7 +995,7 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {
|
|||
///
|
||||
/// TODO
|
||||
#[inline]
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
pub fn entry(&mut self, value: T) -> Entry<'_, T, A>
|
||||
where
|
||||
T: Ord,
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ use crate::alloc::{Allocator, Global};
|
|||
/// println!("Our BTreeSet: {:?}", set);
|
||||
/// assert!(set.iter().eq(&["a", "b", "c", "d", "e"]));
|
||||
/// ```
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
pub enum Entry<
|
||||
'a,
|
||||
T,
|
||||
|
|
@ -60,7 +60,7 @@ pub enum Entry<
|
|||
/// Entry::Occupied(_) => { }
|
||||
/// }
|
||||
/// ```
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
Occupied(OccupiedEntry<'a, T, A>),
|
||||
|
||||
/// A vacant entry.
|
||||
|
|
@ -79,11 +79,11 @@ pub enum Entry<
|
|||
/// Entry::Vacant(_) => { }
|
||||
/// }
|
||||
/// ```
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
Vacant(VacantEntry<'a, T, A>),
|
||||
}
|
||||
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
impl<T: Debug + Ord, A: Allocator + Clone> Debug for Entry<'_, T, A> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match *self {
|
||||
|
|
@ -129,7 +129,7 @@ impl<T: Debug + Ord, A: Allocator + Clone> Debug for Entry<'_, T, A> {
|
|||
/// assert_eq!(set.get(&"c"), None);
|
||||
/// assert_eq!(set.len(), 2);
|
||||
/// ```
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
pub struct OccupiedEntry<
|
||||
'a,
|
||||
T,
|
||||
|
|
@ -138,7 +138,7 @@ pub struct OccupiedEntry<
|
|||
pub(super) inner: map::OccupiedEntry<'a, T, SetValZST, A>,
|
||||
}
|
||||
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
impl<T: Debug + Ord, A: Allocator + Clone> Debug for OccupiedEntry<'_, T, A> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("OccupiedEntry").field("value", self.get()).finish()
|
||||
|
|
@ -171,7 +171,7 @@ impl<T: Debug + Ord, A: Allocator + Clone> Debug for OccupiedEntry<'_, T, A> {
|
|||
/// }
|
||||
/// assert!(set.contains("b") && set.len() == 2);
|
||||
/// ```
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
pub struct VacantEntry<
|
||||
'a,
|
||||
T,
|
||||
|
|
@ -180,7 +180,7 @@ pub struct VacantEntry<
|
|||
pub(super) inner: map::VacantEntry<'a, T, SetValZST, A>,
|
||||
}
|
||||
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
impl<T: Debug + Ord, A: Allocator + Clone> Debug for VacantEntry<'_, T, A> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_tuple("VacantEntry").field(self.get()).finish()
|
||||
|
|
@ -203,7 +203,7 @@ impl<'a, T: Ord, A: Allocator + Clone> Entry<'a, T, A> {
|
|||
/// assert_eq!(entry.get(), &"horseyland");
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
pub fn insert(self) -> OccupiedEntry<'a, T, A> {
|
||||
match self {
|
||||
Occupied(entry) => entry,
|
||||
|
|
@ -232,7 +232,7 @@ impl<'a, T: Ord, A: Allocator + Clone> Entry<'a, T, A> {
|
|||
/// assert_eq!(set.len(), 1);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
pub fn or_insert(self) {
|
||||
if let Vacant(entry) = self {
|
||||
entry.insert();
|
||||
|
|
@ -257,7 +257,7 @@ impl<'a, T: Ord, A: Allocator + Clone> Entry<'a, T, A> {
|
|||
/// assert_eq!(set.entry("horseland").get(), &"horseland");
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
pub fn get(&self) -> &T {
|
||||
match *self {
|
||||
Occupied(ref entry) => entry.get(),
|
||||
|
|
@ -285,7 +285,7 @@ impl<'a, T: Ord, A: Allocator + Clone> OccupiedEntry<'a, T, A> {
|
|||
/// }
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
pub fn get(&self) -> &T {
|
||||
self.inner.key()
|
||||
}
|
||||
|
|
@ -310,7 +310,7 @@ impl<'a, T: Ord, A: Allocator + Clone> OccupiedEntry<'a, T, A> {
|
|||
/// assert_eq!(set.contains("poneyland"), false);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
pub fn remove(self) -> T {
|
||||
self.inner.remove_entry().0
|
||||
}
|
||||
|
|
@ -331,7 +331,7 @@ impl<'a, T: Ord, A: Allocator + Clone> VacantEntry<'a, T, A> {
|
|||
/// assert_eq!(set.entry("poneyland").get(), &"poneyland");
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
pub fn get(&self) -> &T {
|
||||
self.inner.key()
|
||||
}
|
||||
|
|
@ -353,7 +353,7 @@ impl<'a, T: Ord, A: Allocator + Clone> VacantEntry<'a, T, A> {
|
|||
/// }
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
pub fn into_value(self) -> T {
|
||||
self.inner.into_key()
|
||||
}
|
||||
|
|
@ -376,7 +376,7 @@ impl<'a, T: Ord, A: Allocator + Clone> VacantEntry<'a, T, A> {
|
|||
/// assert!(set.contains("poneyland"));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[unstable(feature = "btree_set_entry", issue = "none")]
|
||||
#[unstable(feature = "btree_set_entry", issue = "133549")]
|
||||
pub fn insert(self) {
|
||||
self.inner.insert(SetValZST);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue