fn create_requests(&self, input_content: &InputContent) -> Result<HashSet<Request>> {
        let mut requests: HashSet<Request> = HashSet::with_capacity(self.urls.len());

        let base_input = match &input_content.input {
            Input::RemoteUrl(url) => Some(Url::parse(&format!(
                "{}://{}",
                url.scheme(),
                url.host_str().ok_or(ErrorKind::InvalidUrlHost)?
            ))?),
            _ => None,
            // other inputs do not have a URL to extract a base
        };

        for url in &self.urls {
            let req = if let Ok(uri) = Uri::try_from(url.as_ref()) {
                Request::new(uri, input_content.input.clone())
            } else if let Some(url) = self.base.as_ref().and_then(|u| u.join(url)) {
                Request::new(Uri { url }, input_content.input.clone())
            } else if let Input::FsPath(root) = &input_content.input {
                if url::is_anchor(url) {
                    // Silently ignore anchor links for now
                    continue;
                }
                match self.create_uri_from_path(root, url)? {
                    Some(url) => Request::new(Uri { url }, input_content.input.clone()),
                    None => {
                        // In case we cannot create a URI from a path but we didn't receive an error,
                        // it means that some preconditions were not met, e.g. the `base_url` wasn't set.
                        continue;
                    }
                }
            } else if let Some(url) = base_input.as_ref().map(|u| u.join(url)) {
                if self.base.is_some() {
                    continue;
                }
                Request::new(Uri { url: url? }, input_content.input.clone())
            } else {
                info!("Handling of {} not implemented yet", &url);
                continue;
            };
            requests.insert(req);
        }
        Ok(requests)
    }
/// Create requests out of the collected URLs.
/// Only keeps legit URLs. For example this filters out anchors.
Create requests out of the collected URLs.
Only keeps legit URLs. For example this filters out anchors.
Create requests out of the collected URLs . Only keeps legit URLs . For example this filters out anchors .
fn create_requests(&self, input_content: &InputContent) -> Result<HashSet<Request>> {
        let mut requests: HashSet<Request> = HashSet::with_capacity(self.urls.len());
        let base_input = match &input_content.input {
            Input::RemoteUrl(url) => Some(Url::parse(&format!(
                "{}://{}",
                url.scheme(),
                url.host_str().ok_or(ErrorKind::InvalidUrlHost)?
            ))?),
            _ => None,
            // other inputs do not have a URL to extract a base
        };
        for url in &self.urls {
            let req = if let Ok(uri) = Uri::try_from(url.as_ref()) {
                Request::new(uri, input_content.input.clone())
            } else if let Some(url) = self.base.as_ref().and_then(|u| u.join(url)) {
                Request::new(Uri { url }, input_content.input.clone())
            } else if let Input::FsPath(root) = &input_content.input {
                if url::is_anchor(url) {
                    // Silently ignore anchor links for now
                    continue;
                }
                match self.create_uri_from_path(root, url)? {
                    Some(url) => Request::new(Uri { url }, input_content.input.clone()),
                    None => {
                        // In case we cannot create a URI from a path but we didn't receive an error,
                        // it means that some preconditions were not met, e.g. the `base_url` wasn't set.
                        continue;
                    }
                }
            } else if let Some(url) = base_input.as_ref().map(|u| u.join(url)) {
                if self.base.is_some() {
                    continue;
                }
                Request::new(Uri { url: url? }, input_content.input.clone())
            } else {
                info!("Handling of {} not implemented yet", &url);
                continue;
            };
            requests.insert(req);
        }
        Ok(requests)
    }
fn create_requests ( & self , input_content : & InputContent ) -> Result < HashSet < Request > > { let mut requests : HashSet < Request > = HashSet :: with_capacity ( self . urls . len ( ) ) ; let base_input = match & input_content . input { Input :: RemoteUrl ( url ) => Some ( Url :: parse ( & format ! ( " " url scheme ( ) url host_str ( ) ok_or ( ErrorKind InvalidUrlHost ) ) ) ? ) , _ => None , // other inputs do not have a URL to extract a base } ; for url in & self . urls { let req = if let Ok ( uri ) = Uri :: try_from ( url . as_ref ( ) ) { Request :: new ( uri , input_content . input . clone ( ) ) } else if let Some ( url ) = self . base . as_ref ( ) . and_then ( | u | u . join ( url ) ) { Request :: new ( Uri { url } , input_content . input . clone ( ) ) } else if let Input :: FsPath ( root ) = & input_content . input { if url :: is_anchor ( url ) { // Silently ignore anchor links for now continue ; } match self . create_uri_from_path ( root , url ) ? { Some ( url ) => Request :: new ( Uri { url } , input_content . input . clone ( ) ) , None => { // In case we cannot create a URI from a path but we didn't receive an error, // it means that some preconditions were not met, e.g. the `base_url` wasn't set. continue ; } } } else if let Some ( url ) = base_input . as_ref ( ) . map ( | u | u . join ( url ) ) { if self . base . is_some ( ) { continue ; } Request :: new ( Uri { url : url ? } , input_content . input . clone ( ) ) } else { info ! ( " " url ) ; continue ; } ; requests . insert ( req ) ; } Ok ( requests ) }
Create requests out of the collected URLs.
Create requests out of the collected URLs .
&self
input_content
&InputContent