@@ -134,6 +134,7 @@ impl<R: io::BufRead, T: PemObject> Iterator for ReadIter<R, T> {
134134pub struct SliceIter < ' a , T > {
135135 current : & ' a [ u8 ] ,
136136 _ty : PhantomData < T > ,
137+ b64_buf : Vec < u8 > ,
137138}
138139
139140impl < ' a , T : PemObject > SliceIter < ' a , T > {
@@ -142,6 +143,7 @@ impl<'a, T: PemObject> SliceIter<'a, T> {
142143 Self {
143144 current,
144145 _ty : PhantomData ,
146+ b64_buf : Vec :: with_capacity ( 1024 ) ,
145147 }
146148 }
147149
@@ -152,9 +154,8 @@ impl<'a, T: PemObject> SliceIter<'a, T> {
152154 /// - Otherwise each decoded section is returned with a `Ok(Some((..., remainder)))` where
153155 /// `remainder` is the part of the `input` that follows the returned section
154156 fn read_section ( & mut self ) -> Result < Option < ( SectionKind , Vec < u8 > ) > , Error > {
155- let mut b64buf = Vec :: with_capacity ( 1024 ) ;
157+ self . b64_buf . clear ( ) ;
156158 let mut section = None ;
157-
158159 loop {
159160 let next_line = if let Some ( index) = self
160161 . current
@@ -172,7 +173,7 @@ impl<'a, T: PemObject> SliceIter<'a, T> {
172173 None
173174 } ;
174175
175- match read ( next_line, & mut section, & mut b64buf ) ? {
176+ match read ( next_line, & mut section, & mut self . b64_buf ) ? {
176177 ControlFlow :: Continue ( ( ) ) => continue ,
177178 ControlFlow :: Break ( item) => return Ok ( item) ,
178179 }
0 commit comments