pub fn do_search<T>(&mut self) -> GenericResult<T>
    where
        T: std::iter::FromIterator<SampleHash>,
    {
        if self.has_done {
            return Err(VTError::AlreadyReachToGoal.into());
        }

        let url = self.search_url(&self.offset);

        let mut res = reqwest::get(url.as_str())?;
        if !res.status().is_success() {
            return Err(VTError::RequestFailed.into());
        }

        let result: SearchResponse = res.json()?;
        if result.response_code != 1 {
            return Err(VTError::ResponseCodeError(result.response_code).into());
        }

        let hashes = result.hashes.ok_or(VTError::RequestFailed)?;

        if let Some(x) = self.goal {
            self.current += hashes.len();
            if x <= self.current {
                self.has_done = true;
            }
        }

        if result.offset.is_none() {
            self.has_done = true;
        }

        self.offset = result.offset;

        SampleHash::try_map(hashes)
    }
/// request once (most 300 samples per a page)
request once (most 300 samples per a page)
request once ( most 300 samples per a page )
pub fn do_search<T>(&mut self) -> GenericResult<T>
    where
        T: std::iter::FromIterator<SampleHash>,
    {
        if self.has_done {
            return Err(VTError::AlreadyReachToGoal.into());
        }
        let url = self.search_url(&self.offset);
        let mut res = reqwest::get(url.as_str())?;
        if !res.status().is_success() {
            return Err(VTError::RequestFailed.into());
        }
        let result: SearchResponse = res.json()?;
        if result.response_code != 1 {
            return Err(VTError::ResponseCodeError(result.response_code).into());
        }
        let hashes = result.hashes.ok_or(VTError::RequestFailed)?;
        if let Some(x) = self.goal {
            self.current += hashes.len();
            if x <= self.current {
                self.has_done = true;
            }
        }
        if result.offset.is_none() {
            self.has_done = true;
        }
        self.offset = result.offset;
        SampleHash::try_map(hashes)
    }
pub fn do_search < T > ( & mut self ) -> GenericResult < T > where T : std :: iter :: FromIterator < SampleHash > , { if self . has_done { return Err ( VTError :: AlreadyReachToGoal . into ( ) ) ; } let url = self . search_url ( & self . offset ) ; let mut res = reqwest :: get ( url . as_str ( ) ) ? ; if ! res . status ( ) . is_success ( ) { return Err ( VTError :: RequestFailed . into ( ) ) ; } let result : SearchResponse = res . json ( ) ? ; if result . response_code != 1 { return Err ( VTError :: ResponseCodeError ( result . response_code ) . into ( ) ) ; } let hashes = result . hashes . ok_or ( VTError :: RequestFailed ) ? ; if let Some ( x ) = self . goal { self . current += hashes . len ( ) ; if x <= self . current { self . has_done = true ; } } if result . offset . is_none ( ) { self . has_done = true ; } self . offset = result . offset ; SampleHash :: try_map ( hashes ) }
request once (most 300 samples per a page)
request once ( most 300 samples per a page )
&mut self