The stable reexport `std::collections::Bound` is now deprecated.
Another deprecated reexport could be added in `alloc`,
but that crate is unstable.
use core::hash::{Hash, Hasher};
use core::iter::{FromIterator, Peekable, FusedIterator};
use core::marker::PhantomData;
+use core::ops::Bound::{Excluded, Included, Unbounded};
use core::ops::Index;
use core::{fmt, intrinsics, mem, ptr};
use borrow::Borrow;
-use Bound::{Excluded, Included, Unbounded};
use range::RangeArgument;
use super::node::{self, Handle, NodeRef, marker};
///
/// ```
/// use std::collections::BTreeMap;
- /// use std::collections::Bound::Included;
+ /// use std::ops::Bound::Included;
///
/// let mut map = BTreeMap::new();
/// map.insert(3, "a");
///
/// ```
/// use std::collections::BTreeSet;
- /// use std::collections::Bound::Included;
+ /// use std::ops::Bound::Included;
///
/// let mut set = BTreeSet::new();
/// set.insert(3);
pub use core::ops; // RangeFull
}
-/// 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> {
- /// An inclusive bound.
- #[stable(feature = "collections_bound", since = "1.17.0")]
- Included(#[stable(feature = "collections_bound", since = "1.17.0")] T),
- /// An exclusive bound.
- #[stable(feature = "collections_bound", since = "1.17.0")]
- Excluded(#[stable(feature = "collections_bound", since = "1.17.0")] T),
- /// An infinite endpoint. Indicates that there is no bound in this direction.
- #[stable(feature = "collections_bound", since = "1.17.0")]
- Unbounded,
-}
-
/// An intermediate trait for specialization of `Extend`.
#[doc(hidden)]
trait SpecExtend<I: IntoIterator> {
//! Range syntax.
use core::ops::{RangeFull, Range, RangeTo, RangeFrom, RangeInclusive, RangeToInclusive};
-use Bound::{self, Excluded, Included, Unbounded};
+use core::ops::Bound::{self, Excluded, Included, Unbounded};
/// `RangeArgument` is implemented by Rust's built-in range types, produced
/// by range syntax like `..`, `a..`, `..b` or `c..d`.
use core::fmt;
use core::hash;
use core::iter::{FromIterator, FusedIterator};
+use core::ops::Bound::{Excluded, Included, Unbounded};
use core::ops::{self, Add, AddAssign, Index, IndexMut};
use core::ptr;
use core::str::pattern::Pattern;
use borrow::{Cow, ToOwned};
use range::RangeArgument;
-use Bound::{Excluded, Included, Unbounded};
use str::{self, from_boxed_utf8_unchecked, FromStr, Utf8Error, Chars};
use vec::Vec;
use boxed::Box;
// except according to those terms.
use std::collections::BTreeMap;
-use std::collections::Bound::{self, Excluded, Included, Unbounded};
use std::collections::btree_map::Entry::{Occupied, Vacant};
+use std::ops::Bound::{self, Excluded, Included, Unbounded};
use std::rc::Rc;
use std::iter::FromIterator;
use core::mem;
#[cfg(not(test))]
use core::num::Float;
+use core::ops::Bound::{Excluded, Included, Unbounded};
use core::ops::{InPlace, Index, IndexMut, Place, Placer};
use core::ops;
use core::ptr;
use raw_vec::RawVec;
use super::range::RangeArgument;
use super::allocator::CollectionAllocErr;
-use Bound::{Excluded, Included, Unbounded};
/// A contiguous growable array type, written `Vec<T>` but pronounced 'vector'.
///
use core::fmt;
use core::iter::{repeat, FromIterator, FusedIterator};
use core::mem;
+use core::ops::Bound::{Excluded, Included, Unbounded};
use core::ops::{Index, IndexMut, Place, Placer, InPlace};
use core::ptr;
use core::ptr::NonNull;
use super::allocator::CollectionAllocErr;
use super::range::RangeArgument;
-use Bound::{Excluded, Included, Unbounded};
use super::vec::Vec;
const INITIAL_CAPACITY: usize = 7; // 2^3 - 1
pub use self::range::{Range, RangeFrom, RangeFull, RangeTo};
#[stable(feature = "inclusive_range", since = "1.26.0")]
-pub use self::range::{RangeInclusive, RangeToInclusive};
+pub use self::range::{RangeInclusive, RangeToInclusive, Bound};
#[unstable(feature = "try_trait", issue = "42327")]
pub use self::try::Try;
// RangeToInclusive<Idx> cannot impl From<RangeTo<Idx>>
// because underflow would be possible with (..0).into()
+
+/// An endpoint of a range of keys.
+///
+/// # Examples
+///
+/// `Bound`s are range endpoints:
+///
+/// ```
+/// #![feature(collections_range)]
+///
+/// use std::collections::range::RangeArgument;
+/// use std::ops::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::ops::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`]: ../../std/collections/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> {
+ /// An inclusive bound.
+ #[stable(feature = "collections_bound", since = "1.17.0")]
+ Included(#[stable(feature = "collections_bound", since = "1.17.0")] T),
+ /// An exclusive bound.
+ #[stable(feature = "collections_bound", since = "1.17.0")]
+ Excluded(#[stable(feature = "collections_bound", since = "1.17.0")] T),
+ /// An infinite endpoint. Indicates that there is no bound in this direction.
+ #[stable(feature = "collections_bound", since = "1.17.0")]
+ Unbounded,
+}
use std::fmt;
use std::mem;
use std::collections::range::RangeArgument;
-use std::collections::Bound::{Excluded, Included, Unbounded};
use std::mem::ManuallyDrop;
+use std::ops::Bound::{Excluded, Included, Unbounded};
pub unsafe trait Array {
type Element;
#![stable(feature = "rust1", since = "1.0.0")]
#[stable(feature = "rust1", since = "1.0.0")]
-pub use alloc::Bound;
+#[rustc_deprecated(reason = "moved to `std::ops::Bound`", since = "1.26.0")]
+pub use ops::Bound;
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc::{BinaryHeap, BTreeMap, BTreeSet};
#[stable(feature = "rust1", since = "1.0.0")]
use std::collections::HashMap;
use std::collections::HashSet;
-use std::collections::Bound::Included;
use std::mem;
+use std::ops::Bound::Included;
fn is_sync<T>(_: T) where T: Sync {}
fn is_send<T>(_: T) where T: Send {}