use wireframe::response::Response;
#[must_use]
#[track_caller]
#[expect(
ungated_async_fn_track_caller,
reason = "track_caller on async fns is unstable"
)]
pub async fn collect_multi_packet<F, E>(resp: Response<F, E>) -> Vec<F> {
match resp {
Response::MultiPacket(mut rx) => {
let mut frames = Vec::new();
while let Some(frame) = rx.recv().await {
frames.push(frame);
}
frames
}
Response::Single(_) => panic!("collect_multi_packet received Response::Single"),
Response::Vec(_) => panic!("collect_multi_packet received Response::Vec"),
Response::Stream(_) => panic!("collect_multi_packet received Response::Stream"),
Response::Empty => panic!("collect_multi_packet received Response::Empty"),
}
}