[−][src]Struct modio::Query
Interface for retrieving search results.
Implementations
impl<T: DeserializeOwned + Send> Query<T>
[src]
pub async fn first(self) -> Result<Option<T>>
[src]
Returns the first search result.
pub async fn first_page(self) -> Result<Vec<T>>
[src]
Returns the first search result page.
pub async fn collect(self) -> Result<Vec<T>>
[src]
Returns the complete search result list.
pub async fn iter(self) -> Result<impl Stream<Item = Result<T>>>
[src]
Provides a stream over all search result items.
Beware that a Filter::with_limit
will NOT limit the number of items returned
by the stream, but limits the page size for the underlying API requests.
Example
use futures_util::TryStreamExt; use modio::filter::prelude::*; let filter = Fulltext::eq("soldier"); let mut st = modio.game(51).mods().search(filter).iter().await?; // Stream of `Mod` while let Some(mod_) = st.try_next().await? { println!("{}. {}", mod_.id, mod_.name); } use futures_util::StreamExt; // Retrieve the first 10 mods. (Default page size is `100`.) let filter = Fulltext::eq("tftd") + with_limit(10); let st = modio.game(51).mods().search(filter).iter().await?; let mut st = st.take(10); // Stream of `Mod` while let Some(mod_) = st.try_next().await? { println!("{}. {}", mod_.id, mod_.name); }
pub async fn paged(self) -> Result<impl Stream<Item = Result<Page<T>>>>
[src]
Provides a stream over all search result pages.
Example
use futures_util::TryStreamExt; use modio::filter::prelude::*; let filter = Fulltext::eq("tftd").limit(10); let mut st = modio.game(51).mods().search(filter).paged().await?; // Stream of paged results `Page<Mod>` with page size = 10 while let Some(page) = st.try_next().await? { println!("Page {}/{}", page.current(), page.page_count()); for item in page { println!(" {}. {}", item.id, item.name); } }
Auto Trait Implementations
impl<T> !RefUnwindSafe for Query<T>
[src]
impl<T> Send for Query<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Query<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Query<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> !UnwindSafe for Query<T>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,