pub struct HttpPaginationOptions {
pub limit: Option<u64>,
pub offset: Option<u64>,
pub reverse: Option<bool>,
}Expand description
HTTP pagination options allow for lazy reading of large sets of data, for example if thousands of messages have been sent and received from a phone number it would be impractical to request all of them at the same time, instead it can be read in shorter pages using limit+offset. This is applied at the server level when requesting data from database.
Fields§
§limit: Option<u64>The maximum amount of return values.
offset: Option<u64>The offset in index to start getting values from. Eg, if the limit was 5, and you want to view page 2, the offset would be 5, then 10, 15, …
reverse: Option<bool>Should return values be reversed? This is useful for getting the first results from a large set without having to know it’s size.
Implementations§
Source§impl HttpPaginationOptions
impl HttpPaginationOptions
Sourcepub fn with_limit(self, limit: u64) -> Self
pub fn with_limit(self, limit: u64) -> Self
Set the limit/page size.
Sourcepub fn with_offset(self, offset: u64) -> Self
pub fn with_offset(self, offset: u64) -> Self
Set request position offset.
Sourcepub fn with_reverse(self, reverse: bool) -> Self
pub fn with_reverse(self, reverse: bool) -> Self
Set the reverse state for options.
Sourcepub fn add_to_body(&self, body: &mut Value)
pub fn add_to_body(&self, body: &mut Value)
Add pagination options to a json Value.
Trait Implementations§
Source§impl Clone for HttpPaginationOptions
impl Clone for HttpPaginationOptions
Source§fn clone(&self) -> HttpPaginationOptions
fn clone(&self) -> HttpPaginationOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HttpPaginationOptions
impl Debug for HttpPaginationOptions
Source§impl Default for HttpPaginationOptions
impl Default for HttpPaginationOptions
Source§fn default() -> HttpPaginationOptions
fn default() -> HttpPaginationOptions
Source§impl PartialEq for HttpPaginationOptions
impl PartialEq for HttpPaginationOptions
Source§impl Serialize for HttpPaginationOptions
impl Serialize for HttpPaginationOptions
impl Copy for HttpPaginationOptions
impl StructuralPartialEq for HttpPaginationOptions
Auto Trait Implementations§
impl Freeze for HttpPaginationOptions
impl RefUnwindSafe for HttpPaginationOptions
impl Send for HttpPaginationOptions
impl Sync for HttpPaginationOptions
impl Unpin for HttpPaginationOptions
impl UnwindSafe for HttpPaginationOptions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more