pub struct Page<T> {
pub items: Vec<T>,
pub offset: u64,
pub limit: u64,
}Expand description
One page of results plus the offset/limit window it represents. The API does not always return a total count, so it is omitted here.
Fields§
§items: Vec<T>§offset: u64§limit: u64Implementations§
Source§impl<T> Page<T>
impl<T> Page<T>
Sourcepub fn new(items: Vec<T>, offset: u64, limit: u64) -> Self
pub fn new(items: Vec<T>, offset: u64, limit: u64) -> Self
Build a page from a vector. offset and limit correspond to the
query parameters that produced this page.
Sourcepub fn is_probably_last(&self) -> bool
pub fn is_probably_last(&self) -> bool
True if this page is “probably last” — i.e. fewer items than the
page size were returned. Heuristic; some endpoints return exactly
limit on the last page.
Sourcepub fn next_offset(&self) -> u64
pub fn next_offset(&self) -> u64
The offset to request for the next page.
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Page<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Page<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> IntoIterator for Page<T>
Iterator helper: converts a Page<T> into an owned iterator over its
items, discarding the window metadata.
impl<T> IntoIterator for Page<T>
Iterator helper: converts a Page<T> into an owned iterator over its
items, discarding the window metadata.
impl<T: Eq> Eq for Page<T>
impl<T> StructuralPartialEq for Page<T>
Auto Trait Implementations§
impl<T> Freeze for Page<T>
impl<T> RefUnwindSafe for Page<T>where
T: RefUnwindSafe,
impl<T> Send for Page<T>where
T: Send,
impl<T> Sync for Page<T>where
T: Sync,
impl<T> Unpin for Page<T>where
T: Unpin,
impl<T> UnsafeUnpin for Page<T>
impl<T> UnwindSafe for Page<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedSum<usize> for Twhere
T: IntoIterator<Item = usize>,
impl<T> CheckedSum<usize> for Twhere
T: IntoIterator<Item = usize>,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.