pub struct NetworkConfig {
pub endpoints: Vec<CdnEndpoint>,
pub timeout: Duration,
pub connect_timeout: Duration,
pub max_concurrent: usize,
pub chunk_size: usize,
pub retry: RetryConfig,
pub compression: bool,
pub user_agent: String,
pub cache_dir: Option<PathBuf>,
pub max_cache_size: u64,
pub monitor_bandwidth: bool,
pub min_bandwidth: u64,
}Expand description
Network loader configuration
Fields§
§endpoints: Vec<CdnEndpoint>CDN endpoints (ordered by preference)
timeout: DurationRequest timeout
connect_timeout: DurationConnect timeout
max_concurrent: usizeMaximum concurrent downloads
chunk_size: usizeChunk size for range requests
retry: RetryConfigRetry configuration
compression: boolEnable compression
user_agent: StringUser agent string
cache_dir: Option<PathBuf>Cache directory
max_cache_size: u64Maximum cache size (bytes)
monitor_bandwidth: boolEnable bandwidth monitoring
min_bandwidth: u64Minimum acceptable bandwidth (bytes/sec)
Implementations§
Source§impl NetworkConfig
impl NetworkConfig
Sourcepub fn with_endpoint(self, endpoint: CdnEndpoint) -> Self
pub fn with_endpoint(self, endpoint: CdnEndpoint) -> Self
Add a CDN endpoint
Sourcepub fn with_cache_dir(self, path: impl Into<PathBuf>) -> Self
pub fn with_cache_dir(self, path: impl Into<PathBuf>) -> Self
Set cache directory
Sourcepub fn with_max_concurrent(self, max: usize) -> Self
pub fn with_max_concurrent(self, max: usize) -> Self
Set maximum concurrent downloads
Sourcepub fn huggingface_hub() -> Self
pub fn huggingface_hub() -> Self
Configure for Hugging Face Hub
Sourcepub fn custom_cdn(base_url: impl Into<String>) -> Self
pub fn custom_cdn(base_url: impl Into<String>) -> Self
Configure for custom CDN
Trait Implementations§
Source§impl Clone for NetworkConfig
impl Clone for NetworkConfig
Source§fn clone(&self) -> NetworkConfig
fn clone(&self) -> NetworkConfig
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 NetworkConfig
impl Debug for NetworkConfig
Source§impl Default for NetworkConfig
impl Default for NetworkConfig
Source§impl<'de> Deserialize<'de> for NetworkConfig
impl<'de> Deserialize<'de> for NetworkConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&NetworkConfig> for ClientConfig
impl From<&NetworkConfig> for ClientConfig
Source§fn from(config: &NetworkConfig) -> Self
fn from(config: &NetworkConfig) -> Self
Converts to this type from the input type.
Source§impl From<&NetworkConfig> for SchedulerConfig
impl From<&NetworkConfig> for SchedulerConfig
Source§fn from(config: &NetworkConfig) -> Self
fn from(config: &NetworkConfig) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for NetworkConfig
impl RefUnwindSafe for NetworkConfig
impl Send for NetworkConfig
impl Sync for NetworkConfig
impl Unpin for NetworkConfig
impl UnwindSafe for NetworkConfig
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