Enum nakadion::consumer::ConnectTimeout [−][src]
pub enum ConnectTimeout {
Infinite,
Seconds(u64),
}
Expand description
The timeout for a request made to Nakadi to connect to a stream including retries
FromStr
ConnectTimeout
can be parsed from a str
slice.
use nakadion::components::connector::ConnectTimeout;
let ct: ConnectTimeout = "infinite".parse().unwrap();
assert_eq!(ct, ConnectTimeout::Infinite);
let ct: ConnectTimeout = "60".parse().unwrap();
assert_eq!(ct, ConnectTimeout::Seconds(60));
// JSON also works
let ct: ConnectTimeout = "\"infinite\"".parse().unwrap();
assert_eq!(ct, ConnectTimeout::Infinite);
let ct: ConnectTimeout = r#"{"seconds":60}"#.parse().unwrap();
assert_eq!(ct, ConnectTimeout::Seconds(60));
let ct: ConnectTimeout = "59".parse().unwrap();
assert_eq!(ct, ConnectTimeout::Seconds(59));
Serialize/Deserialize
use nakadion::components::connector::ConnectTimeout;
use serde_json::{self, json};
let infinite_json = json!("infinite");
let ct: ConnectTimeout = serde_json::from_value(infinite_json).unwrap();
assert_eq!(ct, ConnectTimeout::Infinite);
let seconds_json = json!({"seconds": 25});
let ct: ConnectTimeout = serde_json::from_value(seconds_json).unwrap();
assert_eq!(ct, ConnectTimeout::Seconds(25));
Variants
There is no limit on the number of connect attempts being done
Seconds(u64)
Retry only for the given time.
This not an exact value and the effective timeout might be longer than the value given here.
Tuple Fields of Seconds
0: u64
Implementations
The default name of the environment variable for this type. The name of the environment variable is “ CONNECT_TIMEOUT “
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 “NAKADION_
CONNECT_TIMEOUT
“
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
_
CONNECT_TIMEOUT
“
The underscore and prefix will be omitted if prefix is empty.
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
.
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 “
CONNECT_TIMEOUT
“
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 “NAKADION_ CONNECT_TIMEOUT “
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
_
CONNECT_TIMEOUT
“
The underscore and prefix will be omitted if prefix is empty.
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
.
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 “ CONNECT_TIMEOUT “
Initialize from the environment.
Returns None
if the value could not be read for any reason.
The name of the environment variable is “NAKADION_
CONNECT_TIMEOUT
“
Initialize from the environment.
Returns None
if the value could not be read for any reason.
The name of the environment variable is “prefix
_
CONNECT_TIMEOUT
“
The underscore and prefix will be omitted if prefix is empty.
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
.
Initialize from the environment.
Returns None
if the value could not be read for any reason.
The name of the environment variable is “
CONNECT_TIMEOUT
“
Trait Implementations
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
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for ConnectTimeout
impl Send for ConnectTimeout
impl Sync for ConnectTimeout
impl Unpin for ConnectTimeout
impl UnwindSafe for ConnectTimeout
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more