pub struct ContentRange {
pub start: i64,
pub end: i64,
pub total: Option<i64>,
}Expand description
Content-Range header value.
Rendered exactly as PostgREST’s contentRangeH: no unit prefix, * for an
unknown total, and * in place of the range itself when the response is
empty. See RangeQuery.hs in the PostgREST source.
Fields§
§start: i64Start of range (0-based)
end: i64End of range (inclusive)
total: Option<i64>Total count (or None if unknown)
Implementations§
Source§impl ContentRange
impl ContentRange
Sourcepub fn from_pagination(offset: i64, count: i64, total: Option<i64>) -> Self
pub fn from_pagination(offset: i64, count: i64, total: Option<i64>) -> Self
Build the range for a response that returned count rows starting at
offset.
count is what the query actually returned, so any limit has already
been applied; an empty result yields end < start, which renders as
* rather than a zero-length range.
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
The HTTP status this range implies, following PostgREST’s rangeStatus.
Without a total there is nothing to be partial about, so the answer is always 200.
Trait Implementations§
Source§impl Clone for ContentRange
impl Clone for ContentRange
Source§impl Debug for ContentRange
impl Debug for ContentRange
Source§impl Display for ContentRange
impl Display for ContentRange
impl Eq for ContentRange
Source§impl PartialEq for ContentRange
impl PartialEq for ContentRange
impl StructuralPartialEq for ContentRange
Auto Trait Implementations§
impl Freeze for ContentRange
impl RefUnwindSafe for ContentRange
impl Send for ContentRange
impl Sync for ContentRange
impl Unpin for ContentRange
impl UnsafeUnpin for ContentRange
impl UnwindSafe for ContentRange
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> 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.