pub trait Target {
fn get_id(&self) -> String;
fn check_availability(&self) -> Result<Status, CheckTargetError>;
}
Expand description
Trait specifying a Target that can be used to check if its available.
Required methods
fn check_availability(&self) -> Result<Status, CheckTargetError>
fn check_availability(&self) -> Result<Status, CheckTargetError>
Check if a Target is currently available.
Returns
- On success, the current Status of this Target.
- On failure, a CheckTargetError. This error should be returned in case some internal error occurred.
Notes
This method should be implemented in a non-blocking way to improve performance then used from an async execution context.
Example
assert_eq!(
IcmpTarget::from_str("127.0.0.1").unwrap().check_availability().unwrap(),
Status::Available
);