async fn gather_list_data(
    tx: &Sender<Vec<String>>,
    octo: &octocrab::Octocrab,
    org_name: &str,
) -> Result<(), String> {
    let gh_org = octo.orgs(org_name);

    let repos: Vec<Repository> = match all_repos(&gh_org).await {
        Ok(r) => r,
        Err(e) => {
            return Err(format!(
                "Ran into an error while gathering repositories! {}",
                e
            ))
        }
    };

    for repo in &repos {
        match count_pull_requests(&octo, &org_name, &repo.name).await {
            Ok(count_prs) => {
                if let Err(_) = tx
                    .send(vec![String::from(&repo.name), count_prs.to_string()])
                    .await
                // here we send the entry in `[repository_name, count_prs]` format
                {
                    return Err(String::from("receiver dropped!"));
                }
            }

            Err(e) => {
                return Err(format!(
                    "Ran into an issue while counting PRs for repository {}: {}",
                    &repo.name, e
                ))
            }
        }
    }

    Ok(())
}
/// Given a bounded multi-producer `Sender`, gather and send all relevant data
/// for the `Opt::List` command. This currently includes:
/// - each repository within the given GitHub Organization
/// - and the number of Pull Requests created in the past 30 days.
Given a bounded multi-producer `Sender`, gather and send all relevant data
for the `Opt::List` command. This currently includes:
each repository within the given GitHub Organization
and the number of Pull Requests created in the past 30 days.
Given a bounded multi - producer ` Sender ` gather and send all relevant data for the ` Opt :: List ` command . This currently includes : each repository within the given GitHub Organization and the number of Pull Requests created in the past 30 days .
async fn gather_list_data(
    tx: &Sender<Vec<String>>,
    octo: &octocrab::Octocrab,
    org_name: &str,
) -> Result<(), String> {
    let gh_org = octo.orgs(org_name);
    let repos: Vec<Repository> = match all_repos(&gh_org).await {
        Ok(r) => r,
        Err(e) => {
            return Err(format!(
                "Ran into an error while gathering repositories! {}",
                e
            ))
        }
    };
    for repo in &repos {
        match count_pull_requests(&octo, &org_name, &repo.name).await {
            Ok(count_prs) => {
                if let Err(_) = tx
                    .send(vec![String::from(&repo.name), count_prs.to_string()])
                    .await
                // here we send the entry in `[repository_name, count_prs]` format
                {
                    return Err(String::from("receiver dropped!"));
                }
            }
            Err(e) => {
                return Err(format!(
                    "Ran into an issue while counting PRs for repository {}: {}",
                    &repo.name, e
                ))
            }
        }
    }
    Ok(())
}
async fn gather_list_data ( tx : & Sender < Vec < String > > , octo : & octocrab :: Octocrab , org_name : & str , ) -> Result < ( ) , String > { let gh_org = octo . orgs ( org_name ) ; let repos : Vec < Repository > = match all_repos ( & gh_org ) . await { Ok ( r ) => r , Err ( e ) => { return Err ( format ! ( " " e ) ) } } ; for repo in & repos { match count_pull_requests ( & octo , & org_name , & repo . name ) . await { Ok ( count_prs ) => { if let Err ( _ ) = tx . send ( vec ! [ String from ( repo name ) count_prs to_string ( ) ] ) . await // here we send the entry in `[repository_name, count_prs]` format { return Err ( String :: from ( " " ) ) ; } } Err ( e ) => { return Err ( format ! ( " " repo name e ) ) } } } Ok ( ( ) ) }
Given a bounded multi-producer `Sender`, gather and send all relevant data
for the `Opt::List` command.
Given a bounded multi - producer ` Sender ` gather and send all relevant data for the ` Opt :: List ` command .
tx
&Sender<Vec<String>>
octo
&octocrab::Octocrab
org_name
&str
tx
&Sender<Vec<String>>
octo
&octocrab::Octocrab
org_name
&str