mirror of
https://github.com/YGGverse/btracker.git
synced 2026-03-31 17:15:31 +00:00
implement pagination
This commit is contained in:
parent
d014358028
commit
4e4f260190
5 changed files with 67 additions and 36 deletions
|
|
@ -74,12 +74,13 @@ impl Storage {
|
|||
pub fn torrents(
|
||||
&self,
|
||||
sort_order: Option<(Sort, Order)>,
|
||||
start: Option<usize>,
|
||||
limit: Option<usize>,
|
||||
) -> Result<Vec<Torrent>, String> {
|
||||
let f = self.files(sort_order)?;
|
||||
let l = limit.unwrap_or(f.len());
|
||||
let mut b = Vec::with_capacity(l);
|
||||
for file in f.into_iter().take(l) {
|
||||
for file in f.into_iter().skip(start.unwrap_or_default()).take(l) {
|
||||
if file
|
||||
.path()
|
||||
.extension()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue