kensho/src/page.rs
Thomas Gideon 36471da6a9 Address lints
- Remove unneeded box, add as_ref when passing client Box.
- Remove unnecessary borrows.
2024-10-06 10:43:32 -04:00

17 lines
484 B
Rust

use chrono::{DateTime, Utc};
use megalodon::entities::Status;
#[derive(Debug)]
pub(super) struct Page<'a> {
pub oldest_id: Option<String>,
pub oldest: Option<&'a DateTime<Utc>>,
pub newest: Option<&'a DateTime<Utc>>,
}
pub(super) fn bounds_from(statuses: &[Status]) -> Page<'_> {
Page {
newest: statuses.first().map(|s| &s.created_at),
oldest_id: statuses.last().map(|s| s.id.clone()),
oldest: statuses.last().map(|s| &s.created_at),
}
}