nbits: uint
}
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-// FIXME(Gankro): NopeNopeNopeNopeNope (wait for IndexGet to be a thing)
-impl Index<uint,bool> for Bitv {
- #[inline]
- fn index(&self, i: &uint) -> &bool {
- if self.get(*i).expect("index out of bounds") {
- &TRUE
- } else {
- &FALSE
- }
- }
-}
-
-#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
// FIXME(Gankro): NopeNopeNopeNopeNope (wait for IndexGet to be a thing)
impl Index<uint> for Bitv {
type Output = bool;
}
}
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-#[stable]
-impl<K: Ord, Sized? Q, V> Index<Q, V> for BTreeMap<K, V>
- where Q: BorrowFrom<K> + Ord
-{
- fn index(&self, key: &Q) -> &V {
- self.get(key).expect("no entry found for key")
- }
-}
-
-#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
#[stable]
impl<K: Ord, Sized? Q, V> Index<Q> for BTreeMap<K, V>
where Q: BorrowFrom<K> + Ord
}
}
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-#[stable]
-impl<K: Ord, Sized? Q, V> IndexMut<Q, V> for BTreeMap<K, V>
- where Q: BorrowFrom<K> + Ord
-{
- fn index_mut(&mut self, key: &Q) -> &mut V {
- self.get_mut(key).expect("no entry found for key")
- }
-}
-
-#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
#[stable]
impl<K: Ord, Sized? Q, V> IndexMut<Q> for BTreeMap<K, V>
where Q: BorrowFrom<K> + Ord
}
}
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-#[stable]
-impl<A> Index<uint, A> for RingBuf<A> {
- #[inline]
- fn index<'a>(&'a self, i: &uint) -> &'a A {
- self.get(*i).expect("Out of bounds access")
- }
-}
-
-#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
#[stable]
impl<A> Index<uint> for RingBuf<A> {
type Output = A;
}
}
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-#[stable]
-impl<A> IndexMut<uint, A> for RingBuf<A> {
- #[inline]
- fn index_mut<'a>(&'a mut self, i: &uint) -> &'a mut A {
- self.get_mut(*i).expect("Out of bounds access")
- }
-}
-
-#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
#[stable]
impl<A> IndexMut<uint> for RingBuf<A> {
type Output = A;
}
}
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-#[experimental = "waiting on Index stability"]
-impl<T> Index<uint,T> for Vec<T> {
- #[inline]
- fn index<'a>(&'a self, index: &uint) -> &'a T {
- &self.as_slice()[*index]
- }
-}
-
-#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
#[experimental = "waiting on Index stability"]
impl<T> Index<uint> for Vec<T> {
type Output = T;
}
}
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-impl<T> IndexMut<uint,T> for Vec<T> {
- #[inline]
- fn index_mut<'a>(&'a mut self, index: &uint) -> &'a mut T {
- &mut self.as_mut_slice()[*index]
- }
-}
-
-#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
impl<T> IndexMut<uint> for Vec<T> {
type Output = T;
}
}
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-#[stable]
-impl<V> Index<uint, V> for VecMap<V> {
- #[inline]
- fn index<'a>(&'a self, i: &uint) -> &'a V {
- self.get(i).expect("key not present")
- }
-}
-
-#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
impl<V> Index<uint> for VecMap<V> {
type Output = V;
}
}
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-#[stable]
-impl<V> IndexMut<uint, V> for VecMap<V> {
- #[inline]
- fn index_mut<'a>(&'a mut self, i: &uint) -> &'a mut V {
- self.get_mut(i).expect("key not present")
- }
-}
-
-#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
#[stable]
impl<V> IndexMut<uint> for VecMap<V> {
type Output = V;
shr_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 }
-// NOTE(stage0) remove trait after a snapshot
-#[cfg(stage0)]
-#[allow(missing_docs)]
-#[lang="index"]
-pub trait Index<Sized? Index, Sized? Result> for Sized? {
- /// The method for the indexing (`Foo[Bar]`) operation
- fn index<'a>(&'a self, index: &Index) -> &'a Result;
-}
-
/// The `Index` trait is used to specify the functionality of indexing operations
/// like `arr[idx]` when used in an immutable context.
///
/// Foo[Foo];
/// }
/// ```
-#[cfg(not(stage0))] // NOTE(stage0) remove cfg after a snapshot
#[lang="index"]
pub trait Index<Sized? Index> for Sized? {
type Sized? Output;
fn index<'a>(&'a self, index: &Index) -> &'a Self::Output;
}
-// NOTE(stage0) remove trait after a snapshot
-#[cfg(stage0)]
-#[allow(missing_docs)]
-#[lang="index_mut"]
-pub trait IndexMut<Sized? Index, Sized? Result> for Sized? {
- /// The method for the indexing (`Foo[Bar]`) operation
- fn index_mut<'a>(&'a mut self, index: &Index) -> &'a mut Result;
-}
-
/// The `IndexMut` trait is used to specify the functionality of indexing
/// operations like `arr[idx]`, when used in a mutable context.
///
/// &mut Foo[Foo];
/// }
/// ```
-#[cfg(not(stage0))] // NOTE(stage0) remove cfg after a snapshot
#[lang="index_mut"]
pub trait IndexMut<Sized? Index> for Sized? {
type Sized? Output;
}
}
-// NOTE(stage0) remove impl after a snapshot
-#[cfg(stage0)]
-impl<T> ops::Index<uint, T> for [T] {
- fn index(&self, &index: &uint) -> &T {
- assert!(index < self.len());
-
- unsafe { mem::transmute(self.repr().data.offset(index as int)) }
- }
-}
-
-#[cfg(not(stage0))] // NOTE(stage0) remove cfg after a snapshot
impl<T> ops::Index<uint> for [T] {
type Output = T;
}
}
-// NOTE(stage0) remove impl after a snapshot
-#[cfg(stage0)]
-impl<T> ops::IndexMut<uint, T> for [T] {
- fn index_mut(&mut self, &index: &uint) -> &mut T {
- assert!(index < self.len());
-
- unsafe { mem::transmute(self.repr().data.offset(index as int)) }
- }
-}
-
-#[cfg(not(stage0))] // NOTE(stage0) remove cfg after a snapshot
impl<T> ops::IndexMut<uint> for [T] {
type Output = T;
}
}
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-impl<'a> ops::Index<&'a str, Json> for Json {
- fn index(&self, idx: & &str) -> &Json {
- self.find(*idx).unwrap()
- }
-}
-
-#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
impl<'a> ops::Index<&'a str> for Json {
type Output = Json;
}
}
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-impl ops::Index<uint, Json> for Json {
- fn index<'a>(&'a self, idx: &uint) -> &'a Json {
- match self {
- &Json::Array(ref v) => v.index(idx),
- _ => panic!("can only index Json with uint if it is an array")
- }
- }
-}
-
-#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
impl ops::Index<uint> for Json {
type Output = Json;
}
}
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-#[stable]
-impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> Index<Q, V> for HashMap<K, V, H>
- where Q: BorrowFrom<K> + Hash<S> + Eq
-{
- #[inline]
- fn index<'a>(&'a self, index: &Q) -> &'a V {
- self.get(index).expect("no entry found for key")
- }
-}
-
-#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
#[stable]
impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> Index<Q> for HashMap<K, V, H>
where Q: BorrowFrom<K> + Hash<S> + Eq
}
}
-// NOTE(stage0): remove impl after a snapshot
-#[cfg(stage0)]
-#[stable]
-impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> IndexMut<Q, V> for HashMap<K, V, H>
- where Q: BorrowFrom<K> + Hash<S> + Eq
-{
- #[inline]
- fn index_mut<'a>(&'a mut self, index: &Q) -> &'a mut V {
- self.get_mut(index).expect("no entry found for key")
- }
-}
-
-#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
#[stable]
impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> IndexMut<Q> for HashMap<K, V, H>
where Q: BorrowFrom<K> + Hash<S> + Eq
+S 2015-01-04 b2085d9
+ freebsd-x86_64 50ccb6bf9c0645d0746a5167493a39b2be40c2d4
+ linux-i386 b880b98d832c9a049b8ef6a50df50061e363de5a
+ linux-x86_64 82a09c162474b69d2d1e4e8399086f3f0f4e31c3
+ macos-i386 569055bb10d96ab25f78ecf2c80ffbccd5e69b8d
+ macos-x86_64 cff1f9ebd63dae6890359b7d353bd9486d8ecdfc
+ winnt-i386 553790fe493413287a19d17a42bf7225d3e2272d
+ winnt-x86_64 bab0d13960afb7ccdd6bf11452de1b9c457cc3e9
+
S 2015-01-02 c894171
freebsd-x86_64 ea8bcf75eada3539f5cbab51708eecf40d436b77
linux-i386 646ae265721e3cbe19404aae4fea4ffa1f1d90cf