]> git.lizzy.rs Git - rust.git/blobdiff - src/libcollections/lib.rs
Auto merge of #41258 - clarcharr:str_box_extras, r=Kimundi
[rust.git] / src / libcollections / lib.rs
index 99afd08e81183eb451df419c93a633b43456bb9c..842f2f44fff9e8166652695f93e50fdfdf96ca9c 100644 (file)
@@ -35,6 +35,7 @@
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 #![cfg_attr(not(test), feature(char_escape_debug))]
+#![cfg_attr(not(test), feature(core_float))]
 #![feature(core_intrinsics)]
 #![feature(dropck_eyepatch)]
 #![feature(exact_size_is_empty)]
@@ -42,6 +43,7 @@
 #![feature(fused)]
 #![feature(generic_param_attrs)]
 #![feature(heap_api)]
+#![feature(i128_type)]
 #![feature(inclusive_range)]
 #![feature(lang_items)]
 #![feature(manually_drop)]
@@ -58,6 +60,7 @@
 #![feature(specialization)]
 #![feature(staged_api)]
 #![feature(str_internals)]
+#![feature(str_box_extras)]
 #![feature(str_mut_extras)]
 #![feature(trusted_len)]
 #![feature(unicode)]
@@ -87,9 +90,6 @@
 #[doc(no_inline)]
 pub use linked_list::LinkedList;
 #[doc(no_inline)]
-#[allow(deprecated)]
-pub use enum_set::EnumSet;
-#[doc(no_inline)]
 pub use vec_deque::VecDeque;
 #[doc(no_inline)]
 pub use string::String;
 pub mod binary_heap;
 mod btree;
 pub mod borrow;
-pub mod enum_set;
 pub mod fmt;
 pub mod linked_list;
 pub mod range;
@@ -135,6 +134,42 @@ mod std {
 }
 
 /// An endpoint of a range of keys.
+///
+/// # Examples
+///
+/// `Bound`s are range endpoints:
+///
+/// ```
+/// #![feature(collections_range)]
+///
+/// use std::collections::range::RangeArgument;
+/// use std::collections::Bound::*;
+///
+/// assert_eq!((..100).start(), Unbounded);
+/// assert_eq!((1..12).start(), Included(&1));
+/// assert_eq!((1..12).end(), Excluded(&12));
+/// ```
+///
+/// Using a tuple of `Bound`s as an argument to [`BTreeMap::range`].
+/// Note that in most cases, it's better to use range syntax (`1..5`) instead.
+///
+/// ```
+/// use std::collections::BTreeMap;
+/// use std::collections::Bound::{Excluded, Included, Unbounded};
+///
+/// let mut map = BTreeMap::new();
+/// map.insert(3, "a");
+/// map.insert(5, "b");
+/// map.insert(8, "c");
+///
+/// for (key, value) in map.range((Excluded(3), Included(8))) {
+///     println!("{}: {}", key, value);
+/// }
+///
+/// assert_eq!(Some((&3, &"a")), map.range((Unbounded, Included(5))).next());
+/// ```
+///
+/// [`BTreeMap::range`]: btree_map/struct.BTreeMap.html#method.range
 #[stable(feature = "collections_bound", since = "1.17.0")]
 #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
 pub enum Bound<T> {