Skip to content

Commit 068c92b

Browse files
committed
Also rename ExactChunks iterator name to ChunksExact
1 parent e09e450 commit 068c92b

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

src/liballoc/slice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ pub use core::slice::{from_ref, from_mut};
124124
#[stable(feature = "slice_get_slice", since = "1.28.0")]
125125
pub use core::slice::SliceIndex;
126126
#[unstable(feature = "chunks_exact", issue = "47115")]
127-
pub use core::slice::{ExactChunks, ExactChunksMut};
127+
pub use core::slice::{ChunksExact, ChunksExactMut};
128128

129129
////////////////////////////////////////////////////////////////////////////////
130130
// Basic slice extension methods

src/libcore/slice/mod.rs

+25-25
Original file line numberDiff line numberDiff line change
@@ -714,12 +714,12 @@ impl<T> [T] {
714714
/// [`chunks`]: #method.chunks
715715
#[unstable(feature = "chunks_exact", issue = "47115")]
716716
#[inline]
717-
pub fn chunks_exact(&self, chunk_size: usize) -> ExactChunks<T> {
717+
pub fn chunks_exact(&self, chunk_size: usize) -> ChunksExact<T> {
718718
assert!(chunk_size != 0);
719719
let rem = self.len() % chunk_size;
720720
let len = self.len() - rem;
721721
let (fst, snd) = self.split_at(len);
722-
ExactChunks { v: fst, rem: snd, chunk_size }
722+
ChunksExact { v: fst, rem: snd, chunk_size }
723723
}
724724

725725
/// Returns an iterator over `chunk_size` elements of the slice at a time.
@@ -756,12 +756,12 @@ impl<T> [T] {
756756
/// [`chunks_mut`]: #method.chunks_mut
757757
#[unstable(feature = "chunks_exact", issue = "47115")]
758758
#[inline]
759-
pub fn chunks_exact_mut(&mut self, chunk_size: usize) -> ExactChunksMut<T> {
759+
pub fn chunks_exact_mut(&mut self, chunk_size: usize) -> ChunksExactMut<T> {
760760
assert!(chunk_size != 0);
761761
let rem = self.len() % chunk_size;
762762
let len = self.len() - rem;
763763
let (fst, snd) = self.split_at_mut(len);
764-
ExactChunksMut { v: fst, rem: snd, chunk_size }
764+
ChunksExactMut { v: fst, rem: snd, chunk_size }
765765
}
766766

767767
/// Divides one slice into two at an index.
@@ -3660,18 +3660,18 @@ unsafe impl<'a, T> TrustedRandomAccess for ChunksMut<'a, T> {
36603660
/// This struct is created by the [`chunks_exact`] method on [slices].
36613661
///
36623662
/// [`chunks_exact`]: ../../std/primitive.slice.html#method.chunks_exact
3663-
/// [`remainder`]: ../../std/slice/struct.ExactChunks.html#method.remainder
3663+
/// [`remainder`]: ../../std/slice/struct.ChunksExact.html#method.remainder
36643664
/// [slices]: ../../std/primitive.slice.html
36653665
#[derive(Debug)]
36663666
#[unstable(feature = "chunks_exact", issue = "47115")]
3667-
pub struct ExactChunks<'a, T:'a> {
3667+
pub struct ChunksExact<'a, T:'a> {
36683668
v: &'a [T],
36693669
rem: &'a [T],
36703670
chunk_size: usize
36713671
}
36723672

36733673
#[unstable(feature = "chunks_exact", issue = "47115")]
3674-
impl<'a, T> ExactChunks<'a, T> {
3674+
impl<'a, T> ChunksExact<'a, T> {
36753675
/// Return the remainder of the original slice that is not going to be
36763676
/// returned by the iterator. The returned slice has at most `chunk_size-1`
36773677
/// elements.
@@ -3682,9 +3682,9 @@ impl<'a, T> ExactChunks<'a, T> {
36823682

36833683
// FIXME(#26925) Remove in favor of `#[derive(Clone)]`
36843684
#[unstable(feature = "chunks_exact", issue = "47115")]
3685-
impl<'a, T> Clone for ExactChunks<'a, T> {
3686-
fn clone(&self) -> ExactChunks<'a, T> {
3687-
ExactChunks {
3685+
impl<'a, T> Clone for ChunksExact<'a, T> {
3686+
fn clone(&self) -> ChunksExact<'a, T> {
3687+
ChunksExact {
36883688
v: self.v,
36893689
rem: self.rem,
36903690
chunk_size: self.chunk_size,
@@ -3693,7 +3693,7 @@ impl<'a, T> Clone for ExactChunks<'a, T> {
36933693
}
36943694

36953695
#[unstable(feature = "chunks_exact", issue = "47115")]
3696-
impl<'a, T> Iterator for ExactChunks<'a, T> {
3696+
impl<'a, T> Iterator for ChunksExact<'a, T> {
36973697
type Item = &'a [T];
36983698

36993699
#[inline]
@@ -3738,7 +3738,7 @@ impl<'a, T> Iterator for ExactChunks<'a, T> {
37383738
}
37393739

37403740
#[unstable(feature = "chunks_exact", issue = "47115")]
3741-
impl<'a, T> DoubleEndedIterator for ExactChunks<'a, T> {
3741+
impl<'a, T> DoubleEndedIterator for ChunksExact<'a, T> {
37423742
#[inline]
37433743
fn next_back(&mut self) -> Option<&'a [T]> {
37443744
if self.v.len() < self.chunk_size {
@@ -3752,20 +3752,20 @@ impl<'a, T> DoubleEndedIterator for ExactChunks<'a, T> {
37523752
}
37533753

37543754
#[unstable(feature = "chunks_exact", issue = "47115")]
3755-
impl<'a, T> ExactSizeIterator for ExactChunks<'a, T> {
3755+
impl<'a, T> ExactSizeIterator for ChunksExact<'a, T> {
37563756
fn is_empty(&self) -> bool {
37573757
self.v.is_empty()
37583758
}
37593759
}
37603760

37613761
#[unstable(feature = "trusted_len", issue = "37572")]
3762-
unsafe impl<'a, T> TrustedLen for ExactChunks<'a, T> {}
3762+
unsafe impl<'a, T> TrustedLen for ChunksExact<'a, T> {}
37633763

37643764
#[unstable(feature = "chunks_exact", issue = "47115")]
3765-
impl<'a, T> FusedIterator for ExactChunks<'a, T> {}
3765+
impl<'a, T> FusedIterator for ChunksExact<'a, T> {}
37663766

37673767
#[doc(hidden)]
3768-
unsafe impl<'a, T> TrustedRandomAccess for ExactChunks<'a, T> {
3768+
unsafe impl<'a, T> TrustedRandomAccess for ChunksExact<'a, T> {
37693769
unsafe fn get_unchecked(&mut self, i: usize) -> &'a [T] {
37703770
let start = i * self.chunk_size;
37713771
from_raw_parts(self.v.as_ptr().add(start), self.chunk_size)
@@ -3783,18 +3783,18 @@ unsafe impl<'a, T> TrustedRandomAccess for ExactChunks<'a, T> {
37833783
/// This struct is created by the [`chunks_exact_mut`] method on [slices].
37843784
///
37853785
/// [`chunks_exact_mut`]: ../../std/primitive.slice.html#method.chunks_exact_mut
3786-
/// [`into_remainder`]: ../../std/slice/struct.ExactChunksMut.html#method.into_remainder
3786+
/// [`into_remainder`]: ../../std/slice/struct.ChunksExactMut.html#method.into_remainder
37873787
/// [slices]: ../../std/primitive.slice.html
37883788
#[derive(Debug)]
37893789
#[unstable(feature = "chunks_exact", issue = "47115")]
3790-
pub struct ExactChunksMut<'a, T:'a> {
3790+
pub struct ChunksExactMut<'a, T:'a> {
37913791
v: &'a mut [T],
37923792
rem: &'a mut [T],
37933793
chunk_size: usize
37943794
}
37953795

37963796
#[unstable(feature = "chunks_exact", issue = "47115")]
3797-
impl<'a, T> ExactChunksMut<'a, T> {
3797+
impl<'a, T> ChunksExactMut<'a, T> {
37983798
/// Return the remainder of the original slice that is not going to be
37993799
/// returned by the iterator. The returned slice has at most `chunk_size-1`
38003800
/// elements.
@@ -3804,7 +3804,7 @@ impl<'a, T> ExactChunksMut<'a, T> {
38043804
}
38053805

38063806
#[unstable(feature = "chunks_exact", issue = "47115")]
3807-
impl<'a, T> Iterator for ExactChunksMut<'a, T> {
3807+
impl<'a, T> Iterator for ChunksExactMut<'a, T> {
38083808
type Item = &'a mut [T];
38093809

38103810
#[inline]
@@ -3851,7 +3851,7 @@ impl<'a, T> Iterator for ExactChunksMut<'a, T> {
38513851
}
38523852

38533853
#[unstable(feature = "chunks_exact", issue = "47115")]
3854-
impl<'a, T> DoubleEndedIterator for ExactChunksMut<'a, T> {
3854+
impl<'a, T> DoubleEndedIterator for ChunksExactMut<'a, T> {
38553855
#[inline]
38563856
fn next_back(&mut self) -> Option<&'a mut [T]> {
38573857
if self.v.len() < self.chunk_size {
@@ -3867,20 +3867,20 @@ impl<'a, T> DoubleEndedIterator for ExactChunksMut<'a, T> {
38673867
}
38683868

38693869
#[unstable(feature = "chunks_exact", issue = "47115")]
3870-
impl<'a, T> ExactSizeIterator for ExactChunksMut<'a, T> {
3870+
impl<'a, T> ExactSizeIterator for ChunksExactMut<'a, T> {
38713871
fn is_empty(&self) -> bool {
38723872
self.v.is_empty()
38733873
}
38743874
}
38753875

38763876
#[unstable(feature = "trusted_len", issue = "37572")]
3877-
unsafe impl<'a, T> TrustedLen for ExactChunksMut<'a, T> {}
3877+
unsafe impl<'a, T> TrustedLen for ChunksExactMut<'a, T> {}
38783878

38793879
#[unstable(feature = "chunks_exact", issue = "47115")]
3880-
impl<'a, T> FusedIterator for ExactChunksMut<'a, T> {}
3880+
impl<'a, T> FusedIterator for ChunksExactMut<'a, T> {}
38813881

38823882
#[doc(hidden)]
3883-
unsafe impl<'a, T> TrustedRandomAccess for ExactChunksMut<'a, T> {
3883+
unsafe impl<'a, T> TrustedRandomAccess for ChunksExactMut<'a, T> {
38843884
unsafe fn get_unchecked(&mut self, i: usize) -> &'a mut [T] {
38853885
let start = i * self.chunk_size;
38863886
from_raw_parts_mut(self.v.as_mut_ptr().add(start), self.chunk_size)

0 commit comments

Comments
 (0)