#[non_exhaustive]pub struct Paginator<T> {
pub count: Option<u64>,
pub items: Vec<T>,
pub ctoken: Option<String>,
pub visitor_data: Option<String>,
pub endpoint: ContinuationEndpoint,
pub authenticated: bool,
}Expand description
Wrapper around progressively fetched items
The paginator is a wrapper around a list of items that are fetched in pages from the YouTube API (e.g. playlist items, video recommendations or comments).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.count: Option<u64>Total number of items if finite and known.
Note that this number may not be 100% accurate, as this is the number returned by the YouTube API at the initial fetch.
It is intended to be shown to the user (e.g. 1261 comments, 18 Videos) and for progress estimation.
Don’t use this number to check if all items were fetched or for iterating over the items.
items: Vec<T>Content of the paginator
ctoken: Option<String>The continuation token is passed to the YouTube API to fetch more items.
If it is None, it means that no more items can be fetched.
visitor_data: Option<String>YouTube visitor data. Required for fetching the startpage
endpoint: ContinuationEndpointYouTube API endpoint to fetch continuations from
authenticated: boolTrue if the paginator should be fetched with YouTube credentials
Implementations§
Source§impl<T: FromYtItem> Paginator<T>
impl<T: FromYtItem> Paginator<T>
Sourcepub async fn next<Q: AsRef<RustyPipeQuery>>(
&self,
query: Q,
) -> Result<Option<Self>, Error>
pub async fn next<Q: AsRef<RustyPipeQuery>>( &self, query: Q, ) -> Result<Option<Self>, Error>
Get the next page from the paginator (or None if the paginator is exhausted)
Sourcepub async fn extend<Q: AsRef<RustyPipeQuery>>(
&mut self,
query: Q,
) -> Result<bool, Error>
pub async fn extend<Q: AsRef<RustyPipeQuery>>( &mut self, query: Q, ) -> Result<bool, Error>
Extend the items of the paginator by the next page
Returns false if the paginator is exhausted.
Sourcepub async fn extend_pages<Q: AsRef<RustyPipeQuery>>(
&mut self,
query: Q,
n_pages: usize,
) -> Result<(), Error>
pub async fn extend_pages<Q: AsRef<RustyPipeQuery>>( &mut self, query: Q, n_pages: usize, ) -> Result<(), Error>
Extend the items of the paginator by the given amount of pages or until the paginator is exhausted.
Sourcepub async fn extend_limit<Q: AsRef<RustyPipeQuery>>(
&mut self,
query: Q,
n_items: usize,
) -> Result<(), Error>
pub async fn extend_limit<Q: AsRef<RustyPipeQuery>>( &mut self, query: Q, n_items: usize, ) -> Result<(), Error>
Extend the items of the paginator until the given amount of items is reached or the paginator is exhausted.
Sourcepub async fn extend_all<Q: AsRef<RustyPipeQuery>>(
&mut self,
query: Q,
) -> Result<(), Error>
pub async fn extend_all<Q: AsRef<RustyPipeQuery>>( &mut self, query: Q, ) -> Result<(), Error>
Extend the items of the paginator until the paginator is exhausted.
Source§impl Paginator<HistoryItem<VideoItem>>
impl Paginator<HistoryItem<VideoItem>>
Source§impl Paginator<HistoryItem<TrackItem>>
impl Paginator<HistoryItem<TrackItem>>
Source§impl Paginator<Comment>
impl Paginator<Comment>
Sourcepub async fn extend<Q: AsRef<RustyPipeQuery>>(
&mut self,
query: Q,
) -> Result<bool, Error>
pub async fn extend<Q: AsRef<RustyPipeQuery>>( &mut self, query: Q, ) -> Result<bool, Error>
Extend the items of the paginator by the next page
Returns false if the paginator is exhausted.
Sourcepub async fn extend_pages<Q: AsRef<RustyPipeQuery>>(
&mut self,
query: Q,
n_pages: usize,
) -> Result<(), Error>
pub async fn extend_pages<Q: AsRef<RustyPipeQuery>>( &mut self, query: Q, n_pages: usize, ) -> Result<(), Error>
Extend the items of the paginator by the given amount of pages or until the paginator is exhausted.
Sourcepub async fn extend_limit<Q: AsRef<RustyPipeQuery>>(
&mut self,
query: Q,
n_items: usize,
) -> Result<(), Error>
pub async fn extend_limit<Q: AsRef<RustyPipeQuery>>( &mut self, query: Q, n_items: usize, ) -> Result<(), Error>
Extend the items of the paginator until the given amount of items is reached or the paginator is exhausted.
Sourcepub async fn extend_all<Q: AsRef<RustyPipeQuery>>(
&mut self,
query: Q,
) -> Result<(), Error>
pub async fn extend_all<Q: AsRef<RustyPipeQuery>>( &mut self, query: Q, ) -> Result<(), Error>
Extend the items of the paginator until the paginator is exhausted.
Source§impl Paginator<HistoryItem<VideoItem>>
impl Paginator<HistoryItem<VideoItem>>
Sourcepub async fn extend<Q: AsRef<RustyPipeQuery>>(
&mut self,
query: Q,
) -> Result<bool, Error>
pub async fn extend<Q: AsRef<RustyPipeQuery>>( &mut self, query: Q, ) -> Result<bool, Error>
Extend the items of the paginator by the next page
Returns false if the paginator is exhausted.
Sourcepub async fn extend_pages<Q: AsRef<RustyPipeQuery>>(
&mut self,
query: Q,
n_pages: usize,
) -> Result<(), Error>
pub async fn extend_pages<Q: AsRef<RustyPipeQuery>>( &mut self, query: Q, n_pages: usize, ) -> Result<(), Error>
Extend the items of the paginator by the given amount of pages or until the paginator is exhausted.
Sourcepub async fn extend_limit<Q: AsRef<RustyPipeQuery>>(
&mut self,
query: Q,
n_items: usize,
) -> Result<(), Error>
pub async fn extend_limit<Q: AsRef<RustyPipeQuery>>( &mut self, query: Q, n_items: usize, ) -> Result<(), Error>
Extend the items of the paginator until the given amount of items is reached or the paginator is exhausted.
Sourcepub async fn extend_all<Q: AsRef<RustyPipeQuery>>(
&mut self,
query: Q,
) -> Result<(), Error>
pub async fn extend_all<Q: AsRef<RustyPipeQuery>>( &mut self, query: Q, ) -> Result<(), Error>
Extend the items of the paginator until the paginator is exhausted.
Source§impl Paginator<HistoryItem<TrackItem>>
impl Paginator<HistoryItem<TrackItem>>
Sourcepub async fn extend<Q: AsRef<RustyPipeQuery>>(
&mut self,
query: Q,
) -> Result<bool, Error>
pub async fn extend<Q: AsRef<RustyPipeQuery>>( &mut self, query: Q, ) -> Result<bool, Error>
Extend the items of the paginator by the next page
Returns false if the paginator is exhausted.
Sourcepub async fn extend_pages<Q: AsRef<RustyPipeQuery>>(
&mut self,
query: Q,
n_pages: usize,
) -> Result<(), Error>
pub async fn extend_pages<Q: AsRef<RustyPipeQuery>>( &mut self, query: Q, n_pages: usize, ) -> Result<(), Error>
Extend the items of the paginator by the given amount of pages or until the paginator is exhausted.
Sourcepub async fn extend_limit<Q: AsRef<RustyPipeQuery>>(
&mut self,
query: Q,
n_items: usize,
) -> Result<(), Error>
pub async fn extend_limit<Q: AsRef<RustyPipeQuery>>( &mut self, query: Q, n_items: usize, ) -> Result<(), Error>
Extend the items of the paginator until the given amount of items is reached or the paginator is exhausted.
Sourcepub async fn extend_all<Q: AsRef<RustyPipeQuery>>(
&mut self,
query: Q,
) -> Result<(), Error>
pub async fn extend_all<Q: AsRef<RustyPipeQuery>>( &mut self, query: Q, ) -> Result<(), Error>
Extend the items of the paginator until the paginator is exhausted.