pub struct ProfilePhotoIter { /* private fields */ }Expand description
Lazy async iterator over a user’s profile photos.
Obtained from Client::iter_profile_photos.
Fetches photos in pages and yields them one at a time.
Returns Ok(None) when all photos have been consumed.
§Example
let mut iter = client.iter_profile_photos(peer, 0).await?;
while let Some(photo) = iter.next().await? {
println!("{photo:?}");
}Implementations§
Source§impl ProfilePhotoIter
impl ProfilePhotoIter
Sourcepub async fn next(&mut self) -> Result<Option<Photo>, InvocationError>
pub async fn next(&mut self) -> Result<Option<Photo>, InvocationError>
Yield the next profile photo, fetching a new page from Telegram when the local buffer is empty.
Returns Ok(None) when iteration is complete.
Sourcepub async fn collect(self) -> Result<Vec<Photo>, InvocationError>
pub async fn collect(self) -> Result<Vec<Photo>, InvocationError>
Collect all remaining photos into a Vec.
Convenience wrapper around repeated .next() calls.
Sourcepub fn total_count(&self) -> Option<i32>
pub fn total_count(&self) -> Option<i32>
Total number of photos reported by the server on the first page.
Returns None until the first page has been fetched, or if the server
returned a non-slice response (meaning all photos fit in one page).
Auto Trait Implementations§
impl Freeze for ProfilePhotoIter
impl !RefUnwindSafe for ProfilePhotoIter
impl Send for ProfilePhotoIter
impl Sync for ProfilePhotoIter
impl Unpin for ProfilePhotoIter
impl UnsafeUnpin for ProfilePhotoIter
impl !UnwindSafe for ProfilePhotoIter
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> 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>
Converts
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>
Converts
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