mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-03 20:23:59 +00:00
Add lang items for ranges.
This commit is contained in:
parent
21ea66f47a
commit
53c5fcb99f
@ -882,9 +882,11 @@ macro_rules! countable_impl(
|
|||||||
countable_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64)
|
countable_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64)
|
||||||
|
|
||||||
/// An unbounded range.
|
/// An unbounded range.
|
||||||
|
#[lang="full_range"]
|
||||||
pub struct FullRange;
|
pub struct FullRange;
|
||||||
|
|
||||||
/// A range which i bounded at both ends.
|
/// A range which i bounded at both ends.
|
||||||
|
#[lang="range"]
|
||||||
pub struct Range<Idx> {
|
pub struct Range<Idx> {
|
||||||
/// The lower bound of the range (inclusive).
|
/// The lower bound of the range (inclusive).
|
||||||
pub start: Idx,
|
pub start: Idx,
|
||||||
@ -926,6 +928,7 @@ impl<Idx: Clone + Countable> DoubleEndedIterator<Idx> for Range<Idx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A range which is only bounded below.
|
/// A range which is only bounded below.
|
||||||
|
#[lang="range_from"]
|
||||||
pub struct RangeFrom<Idx> {
|
pub struct RangeFrom<Idx> {
|
||||||
/// The lower bound of the range (inclusive).
|
/// The lower bound of the range (inclusive).
|
||||||
pub start: Idx,
|
pub start: Idx,
|
||||||
|
@ -267,6 +267,9 @@ lets_do_this! {
|
|||||||
IndexMutTraitLangItem, "index_mut", index_mut_trait;
|
IndexMutTraitLangItem, "index_mut", index_mut_trait;
|
||||||
SliceTraitLangItem, "slice", slice_trait;
|
SliceTraitLangItem, "slice", slice_trait;
|
||||||
SliceMutTraitLangItem, "slice_mut", slice_mut_trait;
|
SliceMutTraitLangItem, "slice_mut", slice_mut_trait;
|
||||||
|
RangeStructLangItem, "range", range_struct;
|
||||||
|
RangeFromStructLangItem, "range_from", range_from_struct;
|
||||||
|
FullRangeStructLangItem, "full_range", full_range_struct;
|
||||||
|
|
||||||
UnsafeTypeLangItem, "unsafe", unsafe_type;
|
UnsafeTypeLangItem, "unsafe", unsafe_type;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user