pub struct FetchOptions {
pub full_history: bool,
pub probe_days: u32,
pub timeout: Duration,
pub max_concurrency: usize,
pub user_agent: String,
}Expand description
Options for fetching Rust release data.
All fields have sensible defaults, so FetchOptions::default() or
FetchOptions::new() gives a reasonable starting configuration.
§Examples
ⓘ
use rs_histver::{fetch_releases, FetchOptions};
// Default options
let releases = fetch_releases("stable", FetchOptions::default()).await?;
// Full history from RELEASES.md
let releases = fetch_releases("stable",
FetchOptions::new().full_history(true)
).await?;
// Probe recent 7 days of nightly releases
let releases = fetch_releases("nightly",
FetchOptions::new().probe_days(7)
).await?;Fields§
§full_history: boolStable channel: use RELEASES.md for full historical data (default: false = GitHub API)
probe_days: u32Beta/Nightly channels: probe recent N days (default: 30)
timeout: DurationHTTP request timeout (default: 15 seconds)
max_concurrency: usizeMaximum concurrent HTTP requests (default: 10)
user_agent: StringUser-Agent header string
Implementations§
Source§impl FetchOptions
impl FetchOptions
Sourcepub fn full_history(self, v: bool) -> Self
pub fn full_history(self, v: bool) -> Self
Enable RELEASES.md full history mode (stable only).
Sourcepub fn probe_days(self, days: u32) -> Self
pub fn probe_days(self, days: u32) -> Self
Set the number of days to probe for beta/nightly channels.
Sourcepub fn max_concurrency(self, n: usize) -> Self
pub fn max_concurrency(self, n: usize) -> Self
Set the maximum number of concurrent HTTP requests.
Sourcepub fn user_agent(self, ua: impl Into<String>) -> Self
pub fn user_agent(self, ua: impl Into<String>) -> Self
Set a custom User-Agent header.
Trait Implementations§
Source§impl Clone for FetchOptions
impl Clone for FetchOptions
Source§fn clone(&self) -> FetchOptions
fn clone(&self) -> FetchOptions
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 Debug for FetchOptions
impl Debug for FetchOptions
Source§impl Default for FetchOptions
impl Default for FetchOptions
Source§impl From<&FetchOptions> for NetworkConfig
impl From<&FetchOptions> for NetworkConfig
Source§fn from(opts: &FetchOptions) -> Self
fn from(opts: &FetchOptions) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for FetchOptions
impl RefUnwindSafe for FetchOptions
impl Send for FetchOptions
impl Sync for FetchOptions
impl Unpin for FetchOptions
impl UnsafeUnpin for FetchOptions
impl UnwindSafe for FetchOptions
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