- Remove unneeded box, add as_ref when passing client Box. - Remove unnecessary borrows.
17 lines
484 B
Rust
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),
|
|
}
|
|
}
|