pub struct SeriesSearchRequest<'a> { /* private fields */ }Expand description
A builder for a series/search request, returned by Client::search.
Only parameters you set are sent; anything left unset uses FRED’s default.
Finish with send.
use ferric_fred::{OrderBy, SortOrder};
let results = client
.search("unemployment rate")
.order_by(OrderBy::Popularity)
.sort_order(SortOrder::Descending)
.limit(10)
.send()
.await?;
println!("{} total matches", results.count);Implementations§
Source§impl<'a> SeriesSearchRequest<'a>
impl<'a> SeriesSearchRequest<'a>
Sourcepub fn search_type(self, search_type: SearchType) -> Self
pub fn search_type(self, search_type: SearchType) -> Self
How the search text is interpreted (search_type).
Sourcepub fn sort_order(self, order: SortOrder) -> Self
pub fn sort_order(self, order: SortOrder) -> Self
Sort order of the results (sort_order).
Sourcepub fn offset(self, offset: u32) -> Self
pub fn offset(self, offset: u32) -> Self
Number of results to skip from the start (offset), for paging.
Sourcepub async fn send(self) -> Result<SeriesSearchResults>
pub async fn send(self) -> Result<SeriesSearchResults>
Run the search and return the matching series with pagination metadata.
§Errors
Returns an error if the request fails to send, FRED returns a non-success status, or the response body cannot be deserialized.
Trait Implementations§
Source§impl<'a> Clone for SeriesSearchRequest<'a>
impl<'a> Clone for SeriesSearchRequest<'a>
Source§fn clone(&self) -> SeriesSearchRequest<'a>
fn clone(&self) -> SeriesSearchRequest<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for SeriesSearchRequest<'a>
impl<'a> Debug for SeriesSearchRequest<'a>
Source§impl Paginate for SeriesSearchRequest<'_>
impl Paginate for SeriesSearchRequest<'_>
Source§const MAX_PAGE: u32 = 1000
const MAX_PAGE: u32 = 1000
FRED’s maximum page size for this endpoint — the largest
limit it
honors. 1000 for most lists; 10000 for release dates and vintage dates.Source§type Page = SeriesSearchResults
type Page = SeriesSearchResults
The page type this request returns.
Source§fn requested_limit(&self) -> Option<u32>
fn requested_limit(&self) -> Option<u32>
The caller’s requested
limit, if set. send_all
treats it as a ceiling on the total number of items returned.Source§fn requested_offset(&self) -> Option<u32>
fn requested_offset(&self) -> Option<u32>
The caller’s requested
offset, if set — the point
send_all starts paging from.Source§fn with_paging(self, limit: u32, offset: u32) -> Self
fn with_paging(self, limit: u32, offset: u32) -> Self
Return a copy of this request with
limit and offset set.Source§fn send_page(self) -> impl Future<Output = Result<Self::Page>> + Send
fn send_page(self) -> impl Future<Output = Result<Self::Page>> + Send
Send a single page — equivalent to the builder’s own
send.Auto Trait Implementations§
impl<'a> !RefUnwindSafe for SeriesSearchRequest<'a>
impl<'a> !UnwindSafe for SeriesSearchRequest<'a>
impl<'a> Freeze for SeriesSearchRequest<'a>
impl<'a> Send for SeriesSearchRequest<'a>
impl<'a> Sync for SeriesSearchRequest<'a>
impl<'a> Unpin for SeriesSearchRequest<'a>
impl<'a> UnsafeUnpin for SeriesSearchRequest<'a>
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