pub struct MinBytesForConcurrentDownload(_);
Expand description
The minimum number of bytes a download must consist of for the parts to be downloaded concurrently.
Downloading concurrently has an overhead so it can make sens to set this value greater that PART_SIZE_BYTES
.
This setting plays together with MinPartsForConcurrentDownload
.
The default is 0.
Examples
Parsing
let n_bytes: MinBytesForConcurrentDownload = "34".parse().unwrap();
assert_eq!(n_bytes, 34.into());
let n_bytes: MinBytesForConcurrentDownload = "1k".parse().unwrap();
assert_eq!(n_bytes, 1_000.into());
let n_bytes: MinBytesForConcurrentDownload = "1 k".parse().unwrap();
assert_eq!(n_bytes, 1_000.into());
let n_bytes: MinBytesForConcurrentDownload = "1M".parse().unwrap();
assert_eq!(n_bytes, 1_000_000.into());
let n_bytes: MinBytesForConcurrentDownload = "1G".parse().unwrap();
assert_eq!(n_bytes, 1_000_000_000.into());
let n_bytes: MinBytesForConcurrentDownload = "1Ki".parse().unwrap();
assert_eq!(n_bytes, 1_024.into());
let n_bytes: MinBytesForConcurrentDownload = "1Mi".parse().unwrap();
assert_eq!(n_bytes, 1_048_576.into());
let n_bytes: MinBytesForConcurrentDownload = "1Gi".parse().unwrap();
assert_eq!(n_bytes, 1_073_741_824.into());
// Case sensitive
let res = "1K".parse::<MinBytesForConcurrentDownload>();
assert!(res.is_err());
let res = "x".parse::<MinBytesForConcurrentDownload>();
assert!(res.is_err());
let res = "".parse::<MinBytesForConcurrentDownload>();
assert!(res.is_err());
Implementations
sourceimpl MinBytesForConcurrentDownload
impl MinBytesForConcurrentDownload
pub fn new<T>(part_size_bytes: T) -> MinBytesForConcurrentDownload where
T: Into<u64>,
pub const fn from_u64(part_size_bytes: u64) -> MinBytesForConcurrentDownload
pub const fn into_inner(self) -> u64
sourcepub const ENV_TYPE_NAME: &'static str = &"MIN_BYTES_FOR_CONCURRENT_DOWNLOAD"
pub const ENV_TYPE_NAME: &'static str = &"MIN_BYTES_FOR_CONCURRENT_DOWNLOAD"
The default name of the environment variable for this type.
The name of the environment variable is “ MIN_BYTES_FOR_CONCURRENT_DOWNLOAD “
sourcepub fn try_from_env() -> Result<Option<MinBytesForConcurrentDownload>, Error>
pub fn try_from_env() -> Result<Option<MinBytesForConcurrentDownload>, Error>
Initialize from the environment.
Returns None
if the value was not found and fails if the value could not be parsed.
The name of the environment variable is “CONDOW_
MIN_BYTES_FOR_CONCURRENT_DOWNLOAD
“
sourcepub fn try_from_env_prefixed<T>(
prefix: T
) -> Result<Option<MinBytesForConcurrentDownload>, Error> where
T: Into<String>,
pub fn try_from_env_prefixed<T>(
prefix: T
) -> Result<Option<MinBytesForConcurrentDownload>, Error> where
T: Into<String>,
Initialize from the environment.
Returns None
if the value was not found and fails if the value could not be parsed.
The name of the environment variable is “prefix
_
MIN_BYTES_FOR_CONCURRENT_DOWNLOAD
“
The underscore and prefix will be omitted if prefix is empty.
sourcepub fn try_from_env_named<T>(
var_name: T
) -> Result<Option<MinBytesForConcurrentDownload>, Error> where
T: AsRef<str>,
pub fn try_from_env_named<T>(
var_name: T
) -> Result<Option<MinBytesForConcurrentDownload>, Error> where
T: AsRef<str>,
Initialize from the environment.
Returns None
if the value was not found and fails if the value could not be parsed.
The name of the environment variable is var_name
.
sourcepub fn try_from_env_type_name(
) -> Result<Option<MinBytesForConcurrentDownload>, Error>
pub fn try_from_env_type_name(
) -> Result<Option<MinBytesForConcurrentDownload>, Error>
Initialize from the environment.
Returns None
if the value was not found and fails if the value could not be parsed.
The name of the environment variable is “
MIN_BYTES_FOR_CONCURRENT_DOWNLOAD
“
sourcepub fn from_env() -> Result<MinBytesForConcurrentDownload, Error>
pub fn from_env() -> Result<MinBytesForConcurrentDownload, Error>
Initialize from the environment. Fails if the value was not found or if the value could not be parsed. The name of the environment variable is “CONDOW_ MIN_BYTES_FOR_CONCURRENT_DOWNLOAD “
sourcepub fn from_env_prefixed<T>(
prefix: T
) -> Result<MinBytesForConcurrentDownload, Error> where
T: Into<String>,
pub fn from_env_prefixed<T>(
prefix: T
) -> Result<MinBytesForConcurrentDownload, Error> where
T: Into<String>,
Initialize from the environment.
Fails if the value was not found or if the value could not be parsed.
The name of the environment variable is “prefix
_
MIN_BYTES_FOR_CONCURRENT_DOWNLOAD
“
The underscore and prefix will be omitted if prefix is empty.
sourcepub fn from_env_named<T>(
var_name: T
) -> Result<MinBytesForConcurrentDownload, Error> where
T: AsRef<str>,
pub fn from_env_named<T>(
var_name: T
) -> Result<MinBytesForConcurrentDownload, Error> where
T: AsRef<str>,
Initialize from the environment.
Fails if the value was not found or if the value could not be parsed.
The name of the environment variable is var_name
.
sourcepub fn from_env_type_name() -> Result<MinBytesForConcurrentDownload, Error>
pub fn from_env_type_name() -> Result<MinBytesForConcurrentDownload, Error>
Initialize from the environment. Fails if the value was not found or if the value could not be parsed. The name of the environment variable is “ MIN_BYTES_FOR_CONCURRENT_DOWNLOAD “
sourcepub fn from_env_opt() -> Option<MinBytesForConcurrentDownload>
pub fn from_env_opt() -> Option<MinBytesForConcurrentDownload>
Initialize from the environment.
Returns None
if the value could not be read for any reason.
The name of the environment variable is “CONDOW_
MIN_BYTES_FOR_CONCURRENT_DOWNLOAD
“
sourcepub fn from_env_opt_prefixed<T>(
prefix: T
) -> Option<MinBytesForConcurrentDownload> where
T: Into<String>,
pub fn from_env_opt_prefixed<T>(
prefix: T
) -> Option<MinBytesForConcurrentDownload> where
T: Into<String>,
Initialize from the environment.
Returns None
if the value could not be read for any reason.
The name of the environment variable is “prefix
_
MIN_BYTES_FOR_CONCURRENT_DOWNLOAD
“
The underscore and prefix will be omitted if prefix is empty.
sourcepub fn from_env_opt_named<T>(
var_name: T
) -> Option<MinBytesForConcurrentDownload> where
T: AsRef<str>,
pub fn from_env_opt_named<T>(
var_name: T
) -> Option<MinBytesForConcurrentDownload> where
T: AsRef<str>,
Initialize from the environment.
Returns None
if the value could not be read for any reason.
The name of the environment variable is var_name
.
sourcepub fn from_env_opt_type_name() -> Option<MinBytesForConcurrentDownload>
pub fn from_env_opt_type_name() -> Option<MinBytesForConcurrentDownload>
Initialize from the environment.
Returns None
if the value could not be read for any reason.
The name of the environment variable is “
MIN_BYTES_FOR_CONCURRENT_DOWNLOAD
“
Methods from Deref<Target = u64>
Trait Implementations
sourceimpl Clone for MinBytesForConcurrentDownload
impl Clone for MinBytesForConcurrentDownload
sourcefn clone(&self) -> MinBytesForConcurrentDownload
fn clone(&self) -> MinBytesForConcurrentDownload
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for MinBytesForConcurrentDownload
impl Debug for MinBytesForConcurrentDownload
sourceimpl Default for MinBytesForConcurrentDownload
impl Default for MinBytesForConcurrentDownload
sourcefn default() -> MinBytesForConcurrentDownload
fn default() -> MinBytesForConcurrentDownload
Returns the “default value” for a type. Read more
sourceimpl Deref for MinBytesForConcurrentDownload
impl Deref for MinBytesForConcurrentDownload
sourceimpl DerefMut for MinBytesForConcurrentDownload
impl DerefMut for MinBytesForConcurrentDownload
sourcefn deref_mut(&mut self) -> &mut <MinBytesForConcurrentDownload as Deref>::Target
fn deref_mut(&mut self) -> &mut <MinBytesForConcurrentDownload as Deref>::Target
Mutably dereferences the value.
sourceimpl From<Gibi> for MinBytesForConcurrentDownload
impl From<Gibi> for MinBytesForConcurrentDownload
sourcefn from(v: Gibi) -> MinBytesForConcurrentDownload
fn from(v: Gibi) -> MinBytesForConcurrentDownload
Converts to this type from the input type.
sourceimpl From<Giga> for MinBytesForConcurrentDownload
impl From<Giga> for MinBytesForConcurrentDownload
sourcefn from(v: Giga) -> MinBytesForConcurrentDownload
fn from(v: Giga) -> MinBytesForConcurrentDownload
Converts to this type from the input type.
sourceimpl From<Kibi> for MinBytesForConcurrentDownload
impl From<Kibi> for MinBytesForConcurrentDownload
sourcefn from(v: Kibi) -> MinBytesForConcurrentDownload
fn from(v: Kibi) -> MinBytesForConcurrentDownload
Converts to this type from the input type.
sourceimpl From<Kilo> for MinBytesForConcurrentDownload
impl From<Kilo> for MinBytesForConcurrentDownload
sourcefn from(v: Kilo) -> MinBytesForConcurrentDownload
fn from(v: Kilo) -> MinBytesForConcurrentDownload
Converts to this type from the input type.
sourceimpl From<Mebi> for MinBytesForConcurrentDownload
impl From<Mebi> for MinBytesForConcurrentDownload
sourcefn from(v: Mebi) -> MinBytesForConcurrentDownload
fn from(v: Mebi) -> MinBytesForConcurrentDownload
Converts to this type from the input type.
sourceimpl From<Mega> for MinBytesForConcurrentDownload
impl From<Mega> for MinBytesForConcurrentDownload
sourcefn from(v: Mega) -> MinBytesForConcurrentDownload
fn from(v: Mega) -> MinBytesForConcurrentDownload
Converts to this type from the input type.
sourceimpl From<MinBytesForConcurrentDownload> for u64
impl From<MinBytesForConcurrentDownload> for u64
sourcefn from(v: MinBytesForConcurrentDownload) -> u64
fn from(v: MinBytesForConcurrentDownload) -> u64
Converts to this type from the input type.
sourceimpl From<u64> for MinBytesForConcurrentDownload
impl From<u64> for MinBytesForConcurrentDownload
sourcefn from(v: u64) -> MinBytesForConcurrentDownload
fn from(v: u64) -> MinBytesForConcurrentDownload
Converts to this type from the input type.
sourceimpl Ord for MinBytesForConcurrentDownload
impl Ord for MinBytesForConcurrentDownload
sourceimpl PartialEq<MinBytesForConcurrentDownload> for MinBytesForConcurrentDownload
impl PartialEq<MinBytesForConcurrentDownload> for MinBytesForConcurrentDownload
sourcefn eq(&self, other: &MinBytesForConcurrentDownload) -> bool
fn eq(&self, other: &MinBytesForConcurrentDownload) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &MinBytesForConcurrentDownload) -> bool
fn ne(&self, other: &MinBytesForConcurrentDownload) -> bool
This method tests for !=
.
sourceimpl PartialOrd<MinBytesForConcurrentDownload> for MinBytesForConcurrentDownload
impl PartialOrd<MinBytesForConcurrentDownload> for MinBytesForConcurrentDownload
sourcefn partial_cmp(&self, other: &MinBytesForConcurrentDownload) -> Option<Ordering>
fn partial_cmp(&self, other: &MinBytesForConcurrentDownload) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for MinBytesForConcurrentDownload
impl Eq for MinBytesForConcurrentDownload
impl StructuralEq for MinBytesForConcurrentDownload
impl StructuralPartialEq for MinBytesForConcurrentDownload
Auto Trait Implementations
impl RefUnwindSafe for MinBytesForConcurrentDownload
impl Send for MinBytesForConcurrentDownload
impl Sync for MinBytesForConcurrentDownload
impl Unpin for MinBytesForConcurrentDownload
impl UnwindSafe for MinBytesForConcurrentDownload
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more