11use core:: { fmt, iter:: FusedIterator , str:: Chars } ;
22
3- use super :: String ;
3+ use super :: StringView ;
44
55/// A draining iterator for `String`.
66///
7- /// This struct is created by the [`drain`] method on [`String`]. See its
7+ /// This struct is created by the [`drain`] method on [`crate:: String`]. See its
88/// documentation for more.
99///
10- /// [`drain`]: String::drain
11- pub struct Drain < ' a , const N : usize > {
10+ /// [`drain`]: crate:: String::drain
11+ pub struct Drain < ' a > {
1212 /// Will be used as &'a mut String in the destructor
13- pub ( super ) string : * mut String < N > ,
14- /// Start of part to remove
13+ pub ( super ) string : * mut StringView ,
14+ /// Stast of part to remove
1515 pub ( super ) start : usize ,
1616 /// End of part to remove
1717 pub ( super ) end : usize ,
1818 /// Current remaining range to remove
1919 pub ( super ) iter : Chars < ' a > ,
2020}
2121
22- impl < const N : usize > fmt:: Debug for Drain < ' _ , N > {
22+ impl fmt:: Debug for Drain < ' _ > {
2323 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
2424 f. debug_tuple ( "Drain" ) . field ( & self . as_str ( ) ) . finish ( )
2525 }
2626}
2727
28- unsafe impl < const N : usize > Sync for Drain < ' _ , N > { }
29- unsafe impl < const N : usize > Send for Drain < ' _ , N > { }
28+ unsafe impl Sync for Drain < ' _ > { }
29+ unsafe impl Send for Drain < ' _ > { }
3030
31- impl < const N : usize > Drop for Drain < ' _ , N > {
31+ impl Drop for Drain < ' _ > {
3232 fn drop ( & mut self ) {
3333 unsafe {
3434 // Use `Vec::drain`. “Reaffirm” the bounds checks to avoid
@@ -41,7 +41,7 @@ impl<const N: usize> Drop for Drain<'_, N> {
4141 }
4242}
4343
44- impl < ' a , const N : usize > Drain < ' a , N > {
44+ impl < ' a > Drain < ' a > {
4545 /// Returns the remaining (sub)string of this iterator as a slice.
4646 ///
4747 /// # Examples
@@ -61,19 +61,19 @@ impl<'a, const N: usize> Drain<'a, N> {
6161 }
6262}
6363
64- impl < const N : usize > AsRef < str > for Drain < ' _ , N > {
64+ impl AsRef < str > for Drain < ' _ > {
6565 fn as_ref ( & self ) -> & str {
6666 self . as_str ( )
6767 }
6868}
6969
70- impl < const N : usize > AsRef < [ u8 ] > for Drain < ' _ , N > {
70+ impl AsRef < [ u8 ] > for Drain < ' _ > {
7171 fn as_ref ( & self ) -> & [ u8 ] {
7272 self . as_str ( ) . as_bytes ( )
7373 }
7474}
7575
76- impl < const N : usize > Iterator for Drain < ' _ , N > {
76+ impl Iterator for Drain < ' _ > {
7777 type Item = char ;
7878
7979 #[ inline]
@@ -91,18 +91,18 @@ impl<const N: usize> Iterator for Drain<'_, N> {
9191 }
9292}
9393
94- impl < const N : usize > DoubleEndedIterator for Drain < ' _ , N > {
94+ impl DoubleEndedIterator for Drain < ' _ > {
9595 #[ inline]
9696 fn next_back ( & mut self ) -> Option < char > {
9797 self . iter . next_back ( )
9898 }
9999}
100100
101- impl < const N : usize > FusedIterator for Drain < ' _ , N > { }
101+ impl FusedIterator for Drain < ' _ > { }
102102
103103#[ cfg( test) ]
104104mod tests {
105- use super :: String ;
105+ use crate :: String ;
106106
107107 #[ test]
108108 fn drain_front ( ) {
0 commit comments