pub struct DataGovConfig {
pub ckan_config: Arc<Configuration>,
pub mode: OperatingMode,
pub base_download_dir: PathBuf,
pub user_agent: String,
pub max_concurrent_downloads: usize,
pub download_timeout_secs: u64,
pub status_reporter: Option<Arc<dyn StatusReporter + Send + Sync>>,
}Expand description
Configuration for the Data.gov client
Fields§
§ckan_config: Arc<Configuration>CKAN client configuration
mode: OperatingModeOperating mode (affects base download directory)
base_download_dir: PathBufBase download directory for files (before dataset subdirectory)
user_agent: StringUser agent for HTTP requests
max_concurrent_downloads: usizeMaximum concurrent downloads
download_timeout_secs: u64Timeout for downloads in seconds
status_reporter: Option<Arc<dyn StatusReporter + Send + Sync>>Optional status reporter for UI callbacks
Implementations§
Source§impl DataGovConfig
impl DataGovConfig
Sourcepub fn with_download_dir<P: Into<PathBuf>>(self, dir: P) -> Self
pub fn with_download_dir<P: Into<PathBuf>>(self, dir: P) -> Self
Create configuration with custom base download directory
Sourcepub fn with_mode(self, mode: OperatingMode) -> Self
pub fn with_mode(self, mode: OperatingMode) -> Self
Set the operating mode
Sourcepub fn get_base_download_dir(&self) -> PathBuf
pub fn get_base_download_dir(&self) -> PathBuf
Get the base download directory based on operating mode
Sourcepub fn get_dataset_download_dir(&self, dataset_name: &str) -> PathBuf
pub fn get_dataset_download_dir(&self, dataset_name: &str) -> PathBuf
Get the full download directory for a specific dataset
Sourcepub fn with_api_key<S: Into<String>>(self, api_key: S) -> Self
pub fn with_api_key<S: Into<String>>(self, api_key: S) -> Self
Add API key for higher rate limits
Sourcepub fn with_user_agent<S: Into<String>>(self, user_agent: S) -> Self
pub fn with_user_agent<S: Into<String>>(self, user_agent: S) -> Self
Set custom user agent
Sourcepub fn with_max_concurrent_downloads(self, max: usize) -> Self
pub fn with_max_concurrent_downloads(self, max: usize) -> Self
Set maximum concurrent downloads
Sourcepub fn with_download_timeout(self, timeout_secs: u64) -> Self
pub fn with_download_timeout(self, timeout_secs: u64) -> Self
Set download timeout
Sourcepub fn with_status_reporter<R>(self, reporter: Arc<R>) -> Self
pub fn with_status_reporter<R>(self, reporter: Arc<R>) -> Self
Attach a status reporter for UI callbacks
Sourcepub fn without_status_reporter(self) -> Self
pub fn without_status_reporter(self) -> Self
Remove any configured status reporter
Sourcepub fn status_reporter(&self) -> Option<&Arc<dyn StatusReporter + Send + Sync>>
pub fn status_reporter(&self) -> Option<&Arc<dyn StatusReporter + Send + Sync>>
Borrow the configured status reporter
Trait Implementations§
Source§impl Clone for DataGovConfig
impl Clone for DataGovConfig
Source§fn clone(&self) -> DataGovConfig
fn clone(&self) -> DataGovConfig
Returns a duplicate of the value. Read more
1.0.0 · 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 DataGovConfig
impl Debug for DataGovConfig
Auto Trait Implementations§
impl Freeze for DataGovConfig
impl !RefUnwindSafe for DataGovConfig
impl Send for DataGovConfig
impl Sync for DataGovConfig
impl Unpin for DataGovConfig
impl !UnwindSafe for DataGovConfig
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