use deku::{ctx::Limit, prelude::*, DekuRead, DekuWrite}; use std::io::Cursor; #[derive(Debug, DekuRead, DekuWrite)] struct Test { pub a: u64, pub b: u64, pub c: u64, } fn main() { let input: Vec<_> = (0..10_0000) .map(|i| Test { a: i, b: i + 1, c: i + 2, }) .collect(); let custom: Vec = input .iter() .flat_map(|x| x.to_bytes().unwrap().into_iter()) .collect(); let mut binding = Cursor::new(custom.clone()); let mut reader = Reader::new(&mut binding); let ret = as DekuReader>>::from_reader_with_ctx( &mut reader, Limit::new_count(10_0000), ); println!("{:?}", ret); }