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

Get a Targets identifier.

Returns

A unique identifier of this Target.

Example

assert_eq!(IcmpTarget::from_str("127.0.0.1").unwrap().get_id(), "127.0.0.1");

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
);

Implementors