pub struct CommonArgs {
pub target: String,
pub snmp_version: SnmpVersion,
pub community: String,
pub timeout: f64,
pub retries: u32,
pub backoff: BackoffStrategy,
pub backoff_delay: u64,
pub backoff_max: u64,
pub backoff_jitter: f64,
}Expand description
Common arguments shared across all CLI tools.
Fields§
§target: StringTarget host or host:port (default port 161).
snmp_version: SnmpVersionSNMP version: 1, 2c, or 3.
community: StringCommunity string (v1/v2c).
timeout: f64Request timeout in seconds.
retries: u32Retry count.
backoff: BackoffStrategyBackoff strategy between retries: none, fixed, or exponential.
backoff_delay: u64Backoff delay in milliseconds (initial delay for exponential, fixed delay otherwise).
backoff_max: u64Maximum backoff delay in milliseconds (exponential only).
backoff_jitter: f64Jitter factor for exponential backoff (0.0-1.0, e.g., 0.25 means +/-25%).
Implementations§
Source§impl CommonArgs
impl CommonArgs
Sourcepub fn target_addr(&self) -> Result<SocketAddr, String>
pub fn target_addr(&self) -> Result<SocketAddr, String>
Parse the target into a SocketAddr, defaulting to port 161.
Sourcepub fn timeout_duration(&self) -> Duration
pub fn timeout_duration(&self) -> Duration
Get the timeout as a Duration.
Sourcepub fn retry_config(&self) -> Retry
pub fn retry_config(&self) -> Retry
Build a Retry configuration from the CLI arguments.
Trait Implementations§
Source§impl Args for CommonArgs
impl Args for CommonArgs
Source§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Append to
Command so it can instantiate self via
FromArgMatches::update_from_arg_matches_mut Read moreSource§impl CommandFactory for CommonArgs
impl CommandFactory for CommonArgs
Source§impl Debug for CommonArgs
impl Debug for CommonArgs
Source§impl FromArgMatches for CommonArgs
impl FromArgMatches for CommonArgs
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
Assign values from
ArgMatches to self.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
Assign values from
ArgMatches to self.Source§impl Parser for CommonArgs
impl Parser for CommonArgs
Source§fn parse_from<I, T>(itr: I) -> Self
fn parse_from<I, T>(itr: I) -> Self
Parse from iterator, exit on error.
Source§fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
Parse from iterator, return Err on error.
Source§fn update_from<I, T>(&mut self, itr: I)
fn update_from<I, T>(&mut self, itr: I)
Auto Trait Implementations§
impl Freeze for CommonArgs
impl RefUnwindSafe for CommonArgs
impl Send for CommonArgs
impl Sync for CommonArgs
impl Unpin for CommonArgs
impl UnwindSafe for CommonArgs
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