Lines Matching defs:entry
1423 for entry in &map {
1424 black_box(entry);
29202 /// already in the tree upon entry.
29808 mod entry;
29809 pub use entry::{Entry, OccupiedEntry, OccupiedError, VacantEntry};
29907 /// [`Entry API`]: BTreeMap::entry
29923 /// player_stats.entry("health").or_insert(100);
29927 /// player_stats.entry("defence").or_insert_with(random_stat_buff);
29930 /// let stat = player_stats.entry("attack").or_insert(100);
30392 /// Returns the first entry in the map for in-place manipulation.
30393 /// The key of this entry is the minimum key in the map.
30404 /// if let Some(mut entry) = map.first_entry() {
30405 /// if *entry.key() > 0 {
30406 /// entry.insert("first");
30447 self.first_entry().map(|entry| entry.remove_entry())
30475 /// Returns the last entry in the map for in-place manipulation.
30476 /// The key of this entry is the maximum key in the map.
30487 /// if let Some(mut entry) = map.last_entry() {
30488 /// if *entry.key() > 0 {
30489 /// entry.insert("last");
30530 self.last_entry().map(|entry| entry.remove_entry())
30623 match self.entry(key) {
30624 Occupied(mut entry) => Some(entry.insert(value)),
30625 Vacant(entry) => {
30626 entry.insert(value);
30633 /// a mutable reference to the value in the entry.
30636 /// an error containing the occupied entry and the value is returned.
30651 /// assert_eq!(err.entry.key(), &37);
30652 /// assert_eq!(err.entry.get(), &"a");
30660 match self.entry(key) {
30661 Occupied(entry) => Err(OccupiedError { entry, value }),
30662 Vacant(entry) => Ok(entry.insert(value)),
30889 /// Gets the given key's corresponding entry in the map for in-place manipulation.
30902 /// *count.entry(x).or_insert(0) += 1;
30908 pub fn entry(&mut self, key: K) -> Entry<'_, K, V>
31820 self.get(key).expect("no entry found for key")
32915 /// entry is not updated. See the [module-level documentation] for more.
35056 /// A view into a single entry in a map, which may either be vacant or occupied.
35058 /// This `enum` is constructed from the [`entry`] method on [`BTreeMap`].
35060 /// [`entry`]: BTreeMap::entry
35063 /// A vacant entry.
35067 /// An occupied entry.
35082 /// A view into a vacant entry in a `BTreeMap`.
35101 /// A view into an occupied entry in a `BTreeMap`.
35121 /// Contains the occupied entry, and the value that was not inserted.
35124 /// The entry in the map that was already occupied.
35125 pub entry: OccupiedEntry<'a, K, V>,
35126 /// The value which was not inserted, because the entry was already occupied.
35134 .field("key", self.entry.key())
35135 .field("old_value", self.entry.get())
35148 self.entry.key(),
35149 self.entry.get(),
35155 /// Ensures a value is in the entry by inserting the default if empty, and returns
35156 /// a mutable reference to the value in the entry.
35164 /// map.entry("poneyland").or_insert(12);
35171 Occupied(entry) => entry.into_mut(),
35172 Vacant(entry) => entry.insert(default),
35176 /// Ensures a value is in the entry by inserting the result of the default function if empty,
35177 /// and returns a mutable reference to the value in the entry.
35187 /// map.entry("poneyland").or_insert_with(|| s);
35194 Occupied(entry) => entry.into_mut(),
35195 Vacant(entry) => entry.insert(default()),
35199 /// Ensures a value is in the entry by inserting, if empty, the result of the default function.
35201 /// function a reference to the key that was moved during the `.entry(key)` method call.
35213 /// map.entry("poneyland").or_insert_with_key(|key| key.chars().count());
35221 Occupied(entry) => entry.into_mut(),
35222 Vacant(entry) => {
35223 let value = default(entry.key());
35224 entry.insert(value)
35229 /// Returns a reference to this entry's key.
35237 /// assert_eq!(map.entry("poneyland").key(), &"poneyland");
35242 Occupied(ref entry) => entry.key(),
35243 Vacant(ref entry) => entry.key(),
35247 /// Provides in-place mutable access to an occupied entry before any
35257 /// map.entry("poneyland")
35262 /// map.entry("poneyland")
35273 Occupied(mut entry) => {
35274 f(entry.get_mut());
35275 Occupied(entry)
35277 Vacant(entry) => Vacant(entry),
35284 /// Ensures a value is in the entry by inserting the default value if empty,
35285 /// and returns a mutable reference to the value in the entry.
35293 /// map.entry("poneyland").or_default();
35299 Occupied(entry) => entry.into_mut(),
35300 Vacant(entry) => entry.insert(Default::default()),
35315 /// assert_eq!(map.entry("poneyland").key(), &"poneyland");
35332 /// if let Entry::Vacant(v) = map.entry("poneyland") {
35341 /// Sets the value of the entry with the `VacantEntry`'s key,
35352 /// if let Entry::Vacant(o) = map.entry("poneyland") {
35383 /// Gets a reference to the key in the entry.
35391 /// map.entry("poneyland").or_insert(12);
35392 /// assert_eq!(map.entry("poneyland").key(), &"poneyland");
35408 /// map.entry("poneyland").or_insert(12);
35410 /// if let Entry::Occupied(o) = map.entry("poneyland") {
35411 /// // We delete the entry from the map.
35423 /// Gets a reference to the value in the entry.
35432 /// map.entry("poneyland").or_insert(12);
35434 /// if let Entry::Occupied(o) = map.entry("poneyland") {
35443 /// Gets a mutable reference to the value in the entry.
35457 /// map.entry("poneyland").or_insert(12);
35460 /// if let Entry::Occupied(mut o) = map.entry("poneyland") {
35474 /// Converts the entry into a mutable reference to its value.
35487 /// map.entry("poneyland").or_insert(12);
35490 /// if let Entry::Occupied(o) = map.entry("poneyland") {
35500 /// Sets the value of the entry with the `OccupiedEntry`'s key,
35501 /// and returns the entry's old value.
35510 /// map.entry("poneyland").or_insert(12);
35512 /// if let Entry::Occupied(mut o) = map.entry("poneyland") {
35522 /// Takes the value of the entry out of the map, and returns it.
35531 /// map.entry("poneyland").or_insert(12);
35533 /// if let Entry::Occupied(o) = map.entry("poneyland") {
36850 match map.entry(1) {
36861 match map.entry(2) {
36873 match map.entry(3) {
36884 match map.entry(10) {
37217 fn entry<T: Sync + Ord + Default>(v: &mut BTreeMap<T, T>) -> impl Sync + '_ {
37218 v.entry(Default::default())
37222 match v.entry(Default::default()) {
37223 Occupied(entry) => entry,
37229 match v.entry(Default::default()) {
37230 Vacant(entry) => entry,
37286 fn entry<T: Send + Ord + Default>(v: &mut BTreeMap<T, T>) -> impl Send + '_ {
37287 v.entry(Default::default())
37291 match v.entry(Default::default()) {
37292 Occupied(entry) => entry,
37298 match v.entry(Default::default()) {
37299 Vacant(entry) => entry,
37363 match a.entry(key) {
37379 match a.entry(key) {
39783 /// This method does not expect ancestors to already be underfull upon entry