Skip to content

Stabilize Entry types #23509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/libcollections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,26 +124,26 @@ pub struct RangeMut<'a, K: 'a, V: 'a> {
}

/// A view into a single entry in a map, which may either be vacant or occupied.
#[unstable(feature = "collections",
reason = "precise API still under development")]
#[stable(feature = "rust1", since = "1.0.0")]
pub enum Entry<'a, K:'a, V:'a> {
/// A vacant Entry
#[stable(feature = "rust1", since = "1.0.0")]
Vacant(VacantEntry<'a, K, V>),

/// An occupied Entry
#[stable(feature = "rust1", since = "1.0.0")]
Occupied(OccupiedEntry<'a, K, V>),
}

/// A vacant Entry.
#[unstable(feature = "collections",
reason = "precise API still under development")]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct VacantEntry<'a, K:'a, V:'a> {
key: K,
stack: stack::SearchStack<'a, K, V, node::handle::Edge, node::handle::Leaf>,
}

/// An occupied Entry.
#[unstable(feature = "collections",
reason = "precise API still under development")]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct OccupiedEntry<'a, K:'a, V:'a> {
stack: stack::SearchStack<'a, K, V, node::handle::KV, node::handle::LeafOrInternal>,
}
Expand Down Expand Up @@ -1115,9 +1115,9 @@ impl<'a, K, V> DoubleEndedIterator for RangeMut<'a, K, V> {
}

impl<'a, K: Ord, V> Entry<'a, K, V> {
#[unstable(feature = "collections",
reason = "matches collection reform v2 specification, waiting for dust to settle")]
/// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant
#[unstable(feature = "std_misc",
reason = "will soon be replaced by or_insert")]
pub fn get(self) -> Result<&'a mut V, VacantEntry<'a, K, V>> {
match self {
Occupied(entry) => Ok(entry.into_mut()),
Expand Down
16 changes: 9 additions & 7 deletions src/libcollections/vec_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,28 @@ pub struct VecMap<V> {
}

/// A view into a single entry in a map, which may either be vacant or occupied.
#[unstable(feature = "collections",
reason = "precise API still under development")]

#[stable(feature = "rust1", since = "1.0.0")]
pub enum Entry<'a, V:'a> {
/// A vacant Entry
#[stable(feature = "rust1", since = "1.0.0")]
Vacant(VacantEntry<'a, V>),

/// An occupied Entry
#[stable(feature = "rust1", since = "1.0.0")]
Occupied(OccupiedEntry<'a, V>),
}

/// A vacant Entry.
#[unstable(feature = "collections",
reason = "precise API still under development")]

#[stable(feature = "rust1", since = "1.0.0")]
pub struct VacantEntry<'a, V:'a> {
map: &'a mut VecMap<V>,
index: usize,
}

/// An occupied Entry.
#[unstable(feature = "collections",
reason = "precise API still under development")]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct OccupiedEntry<'a, V:'a> {
map: &'a mut VecMap<V>,
index: usize,
Expand Down Expand Up @@ -651,7 +653,7 @@ impl<V> VecMap<V> {

impl<'a, V> Entry<'a, V> {
#[unstable(feature = "collections",
reason = "matches collection reform v2 specification, waiting for dust to settle")]
reason = "will soon be replaced by or_insert")]
/// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant
pub fn get(self) -> Result<&'a mut V, VacantEntry<'a, V>> {
match self {
Expand Down
1 change: 0 additions & 1 deletion src/librustc_lint/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#![feature(rustc_private)]
#![feature(unsafe_destructor)]
#![feature(staged_api)]
#![feature(std_misc)]
#![feature(str_char)]
#![cfg_attr(test, feature(test))]

Expand Down
1 change: 0 additions & 1 deletion src/librustc_typeck/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ This API is completely unstable and subject to change.
#![feature(collections)]
#![feature(core)]
#![feature(int_uint)]
#![feature(std_misc)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
Expand Down
16 changes: 8 additions & 8 deletions src/libstd/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1323,28 +1323,28 @@ pub struct Drain<'a, K: 'a, V: 'a> {
}

/// A view into a single occupied location in a HashMap.
#[unstable(feature = "std_misc",
reason = "precise API still being fleshed out")]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
elem: FullBucket<K, V, &'a mut RawTable<K, V>>,
}

/// A view into a single empty location in a HashMap.
#[unstable(feature = "std_misc",
reason = "precise API still being fleshed out")]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct VacantEntry<'a, K: 'a, V: 'a> {
hash: SafeHash,
key: K,
elem: VacantEntryState<K, V, &'a mut RawTable<K, V>>,
}

/// A view into a single location in a map, which may be vacant or occupied.
#[unstable(feature = "std_misc",
reason = "precise API still being fleshed out")]
#[stable(feature = "rust1", since = "1.0.0")]
pub enum Entry<'a, K: 'a, V: 'a> {
/// An occupied Entry.
#[stable(feature = "rust1", since = "1.0.0")]
Occupied(OccupiedEntry<'a, K, V>),

/// A vacant Entry.
#[stable(feature = "rust1", since = "1.0.0")]
Vacant(VacantEntry<'a, K, V>),
}

Expand Down Expand Up @@ -1465,10 +1465,10 @@ impl<'a, K, V> ExactSizeIterator for Drain<'a, K, V> {
#[inline] fn len(&self) -> usize { self.inner.len() }
}

#[unstable(feature = "std_misc",
reason = "matches collection reform v2 specification, waiting for dust to settle")]
impl<'a, K, V> Entry<'a, K, V> {
/// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant.
#[unstable(feature = "std_misc",
reason = "will soon be replaced by or_insert")]
pub fn get(self) -> Result<&'a mut V, VacantEntry<'a, K, V>> {
match self {
Occupied(entry) => Ok(entry.into_mut()),
Expand Down