async fn validators<H>(&self, height: H, paging: Paging) -> Result<validators::Response, Error>
    where
        H: Into<Height> + Send,
    {
        let height = height.into();
        match paging {
            Paging::Default => {
                self.perform(validators::Request::new(Some(height), None, None))
                    .await
            }
            Paging::Specific {
                page_number,
                per_page,
            } => {
                self.perform(validators::Request::new(
                    Some(height),
                    Some(page_number),
                    Some(per_page),
                ))
                .await
            }
            Paging::All => {
                let mut page_num = 1_usize;
                let mut validators = Vec::new();
                let per_page = DEFAULT_VALIDATORS_PER_PAGE.into();
                loop {
                    let response = self
                        .perform(validators::Request::new(
                            Some(height),
                            Some(page_num.into()),
                            Some(per_page),
                        ))
                        .await?;
                    validators.extend(response.validators);
                    if validators.len() as i32 == response.total {
                        return Ok(validators::Response::new(
                            response.block_height,
                            validators,
                            response.total,
                        ));
                    }
                    page_num += 1;
                }
            }
        }
    }
// TODO(thane): Simplify once validators endpoint removes pagination.
/// `/validators`: get validators a given height.
Simplify once validators endpoint removes pagination.
`/validators`: get validators a given height.
Simplify once validators endpoint removes pagination . ` / validators ` : get validators a given height .
async fn validators<H>(&self, height: H, paging: Paging) -> Result<validators::Response, Error>
    where
        H: Into<Height> + Send,
    {
        let height = height.into();
        match paging {
            Paging::Default => {
                self.perform(validators::Request::new(Some(height), None, None))
                    .await
            }
            Paging::Specific {
                page_number,
                per_page,
            } => {
                self.perform(validators::Request::new(
                    Some(height),
                    Some(page_number),
                    Some(per_page),
                ))
                .await
            }
            Paging::All => {
                let mut page_num = 1_usize;
                let mut validators = Vec::new();
                let per_page = DEFAULT_VALIDATORS_PER_PAGE.into();
                loop {
                    let response = self
                        .perform(validators::Request::new(
                            Some(height),
                            Some(page_num.into()),
                            Some(per_page),
                        ))
                        .await?;
                    validators.extend(response.validators);
                    if validators.len() as i32 == response.total {
                        return Ok(validators::Response::new(
                            response.block_height,
                            validators,
                            response.total,
                        ));
                    }
                    page_num += 1;
                }
            }
        }
    }
async fn validators < H > ( & self , height : H , paging : Paging ) -> Result < validators :: Response , Error > where H : Into < Height > + Send , { let height = height . into ( ) ; match paging { Paging :: Default => { self . perform ( validators :: Request :: new ( Some ( height ) , None , None ) ) . await } Paging :: Specific { page_number , per_page , } => { self . perform ( validators :: Request :: new ( Some ( height ) , Some ( page_number ) , Some ( per_page ) , ) ) . await } Paging :: All => { let mut page_num = 1_usize ; let mut validators = Vec :: new ( ) ; let per_page = DEFAULT_VALIDATORS_PER_PAGE . into ( ) ; loop { let response = self . perform ( validators :: Request :: new ( Some ( height ) , Some ( page_num . into ( ) ) , Some ( per_page ) , ) ) . await ? ; validators . extend ( response . validators ) ; if validators . len ( ) as i32 == response . total { return Ok ( validators :: Response :: new ( response . block_height , validators , response . total , ) ) ; } page_num += 1 ; } } } }
TODO(thane): Simplify once validators endpoint removes pagination.
TODO ( thane ) : Simplify once validators endpoint removes pagination .
&self
height
H
paging
Paging