pub async fn check_for_updates(&mut self, url: &str, handles: Arc<Handles>) -> Result<()> {
        log::trace!("enter: needs_update({}, {:?})", url, handles);

        let api_url = Url::parse(url)?;

        let result = logged_request(&api_url, handles.clone()).await?;
        let body = result.text().await?;

        let json_response: Value = serde_json::from_str(&body)?;

        let latest_version = match json_response["tag_name"].as_str() {
            Some(tag) => tag.trim_start_matches('v'),
            None => {
                bail!("JSON has no tag_name: {}", json_response);
            }
        };

        // if we've gotten this far, we have a string in the form of X.X.X where X is a number
        // all that's left is to compare the current version with the version found above

        if latest_version == self.version {
            // there's really only two possible outcomes if we accept that the tag conforms to
            // the X.X.X pattern:
            //   1. the version strings match, meaning we're up to date
            //   2. the version strings do not match, meaning we're out of date
            //
            // except for developers working on this code, nobody should ever be in a situation
            // where they have a version greater than the latest tagged release
            self.update_status = UpdateStatus::UpToDate;
        } else {
            self.update_status = UpdateStatus::OutOfDate;
        }

        log::trace!("exit: check_for_updates -> {:?}", self.update_status);
        Ok(())
    }
/// Makes a request to the given url, expecting to receive a JSON response that contains a field
/// named `tag_name` that holds a value representing the latest tagged release of this tool.
///
/// ex: v1.1.0
Makes a request to the given url, expecting to receive a JSON response that contains a field
named `tag_name` that holds a value representing the latest tagged release of this tool.


Makes a request to the given url expecting to receive a JSON response that contains a field named ` tag_name ` that holds a value representing the latest tagged release of this tool .
pub async fn check_for_updates(&mut self, url: &str, handles: Arc<Handles>) -> Result<()> {
        log::trace!("enter: needs_update({}, {:?})", url, handles);
        let api_url = Url::parse(url)?;
        let result = logged_request(&api_url, handles.clone()).await?;
        let body = result.text().await?;
        let json_response: Value = serde_json::from_str(&body)?;
        let latest_version = match json_response["tag_name"].as_str() {
            Some(tag) => tag.trim_start_matches('v'),
            None => {
                bail!("JSON has no tag_name: {}", json_response);
            }
        };
        // if we've gotten this far, we have a string in the form of X.X.X where X is a number
        // all that's left is to compare the current version with the version found above
        if latest_version == self.version {
            // there's really only two possible outcomes if we accept that the tag conforms to
            // the X.X.X pattern:
            //   1. the version strings match, meaning we're up to date
            //   2. the version strings do not match, meaning we're out of date
            //
            // except for developers working on this code, nobody should ever be in a situation
            // where they have a version greater than the latest tagged release
            self.update_status = UpdateStatus::UpToDate;
        } else {
            self.update_status = UpdateStatus::OutOfDate;
        }
        log::trace!("exit: check_for_updates -> {:?}", self.update_status);
        Ok(())
    }
pub async fn check_for_updates ( & mut self , url : & str , handles : Arc < Handles > ) -> Result < ( ) > { log :: trace ! ( " " url handles ) ; let api_url = Url :: parse ( url ) ? ; let result = logged_request ( & api_url , handles . clone ( ) ) . await ? ; let body = result . text ( ) . await ? ; let json_response : Value = serde_json :: from_str ( & body ) ? ; let latest_version = match json_response [ " " ] . as_str ( ) { Some ( tag ) => tag . trim_start_matches ( 'v' ) , None => { bail ! ( " " json_response ) ; } } ; // if we've gotten this far, we have a string in the form of X.X.X where X is a number // all that's left is to compare the current version with the version found above if latest_version == self . version { // there's really only two possible outcomes if we accept that the tag conforms to // the X.X.X pattern: //   1. the version strings match, meaning we're up to date //   2. the version strings do not match, meaning we're out of date // // except for developers working on this code, nobody should ever be in a situation // where they have a version greater than the latest tagged release self . update_status = UpdateStatus :: UpToDate ; } else { self . update_status = UpdateStatus :: OutOfDate ; } log :: trace ! ( " " self update_status ) ; Ok ( ( ) ) }
Makes a request to the given url, expecting to receive a JSON response that contains a field
named `tag_name` that holds a value representing the latest tagged release of this tool.
Makes a request to the given url expecting to receive a JSON response that contains a field named ` tag_name ` that holds a value representing the latest tagged release of this tool .
&mut self
url
&str
handles
Arc<Handles>