pub struct PaginatedElements<T>where
T: Serialize,{
pub elements: Vec<T>,
pub total_elements: usize,
pub pagination: Pagination,
}Expand description
Default return type for all routes that return lists.
Since we never want to have an infinitely large list returned from an endpoint, the number of entries an endpoint returns by default is limited.
However, the user must know, how many elements there are in total, as this information is crucial for building pagination elements in a frontend.
This type serves as a wrapper around Vec<T> (which will be serialized to a list in json),
that also includes how many elements there are in total.
Fields§
§elements: Vec<T>§total_elements: usize§pagination: PaginationTrait Implementations§
Auto Trait Implementations§
impl<T> Freeze for PaginatedElements<T>
impl<T> RefUnwindSafe for PaginatedElements<T>where
T: RefUnwindSafe,
impl<T> Send for PaginatedElements<T>where
T: Send,
impl<T> Sync for PaginatedElements<T>where
T: Sync,
impl<T> Unpin for PaginatedElements<T>where
T: Unpin,
impl<T> UnwindSafe for PaginatedElements<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