MCPcopy Create free account
hub / github.com/RustCrypto/utils / into_chunks

Method into_chunks

inout/src/inout_buf.rs:239–260  ·  view source on GitHub ↗
(
        self,
    )

Source from the content-addressed store, hash-verified

237 #[inline(always)]
238 #[must_use]
239 pub fn into_chunks<N: ArraySize>(
240 self,
241 ) -> (InOutBuf<'inp, 'out, Array<T, N>>, InOutBuf<'inp, 'out, T>) {
242 let chunks = self.len() / N::USIZE;
243 let tail_pos = N::USIZE * chunks;
244 let tail_len = self.len() - tail_pos;
245 unsafe {
246 let chunks = InOutBuf {
247 in_ptr: self.in_ptr.cast::<Array<T, N>>(),
248 out_ptr: self.out_ptr.cast::<Array<T, N>>(),
249 len: chunks,
250 _pd: PhantomData,
251 };
252 let tail = InOutBuf {
253 in_ptr: self.in_ptr.add(tail_pos),
254 out_ptr: self.out_ptr.add(tail_pos),
255 len: tail_len,
256 _pd: PhantomData,
257 };
258 (chunks, tail)
259 }
260 }
261}
262
263impl InOutBuf<'_, '_, u8> {

Callers

nothing calls this directly

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected