DEV Community

Cover image for Creating a 'paged' Vec in Rust

Creating a 'paged' Vec in Rust

Sean Policarpio on May 24, 2019

In this post I'll show you some code I wrote for paginating over a Vec collection in Rust. I needed this for a CLI tool I wrote which was meant to ...
Collapse
 
dorrandir profile image
dorrandir

Isn't (index as f32 / self.page_length as f32).floor() as usize always equal to index / self.page_legth?

Collapse
 
kdrakon profile image
Sean Policarpio

You are partially correct; I've updated the post after some Reddit Rust devs pointed out a mistake there.