Function cargo_free::check_availability_with_timeout[][src]

pub fn check_availability_with_timeout(
    name: impl AsRef<str>,
    timeout: Duration
) -> Result<Availability, Error>

Checks the availability for a given crate name. Stops after the given timeout duration and returns Availability::Unknown.

Arguments

  • name: The crate name to check
  • timeout: The timeout after which to stop trying to connect to the crates.io API.

Returns

Ok(Availability) if the name could be resolved. If the crate name is empty, Err(Error::EmptyCrateName) gets returned. Returns Err(Error::NetworkTimeout) if a timeout occurred.