pub struct PageContext {
pub done: bool,
pub token: String,
pub entries: VecDeque<Entry>,
}Expand description
PageContext is the context passing between PageList.
PageLister will init the PageContext, and implementer of PageList should fill the PageContext
based on their needs.
- Set
donetotrueif all page have been fetched. - Update
tokenif there is more page to fetch.tokenis not exposed to users, it’s internal used only. - Push back into the entries for each entry fetched from underlying storage.
NOTE: entries is a VecDeque to avoid unnecessary memory allocation. Only push_back is allowed.
Fields§
§done: booldone is used to indicate whether the list operation is done.
token: Stringtoken is used by underlying storage services to fetch next page.
entries: VecDeque<Entry>entries are used to store entries fetched from underlying storage.
Please always reuse the same VecDeque to avoid unnecessary memory allocation.
PageLister makes sure that entries is reset before calling next_page. Implementer
can call push_back on entries directly.
Auto Trait Implementations§
impl Freeze for PageContext
impl RefUnwindSafe for PageContext
impl Send for PageContext
impl Sync for PageContext
impl Unpin for PageContext
impl UnwindSafe for PageContext
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> 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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Apply a transformation to the response body. Read more
Source§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
Decompress response bodies. Read more
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more