pub struct MapOptions {
pub link_types: Option<Vec<String>>,
pub base_url: Option<String>,
pub filter_extensions: Option<Vec<String>>,
}Fields§
§link_types: Option<Vec<String>>§base_url: Option<String>§filter_extensions: Option<Vec<String>>Implementations§
Source§impl MapOptions
impl MapOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/web-scrape.rs (line 43)
37fn example_mapping() {
38 println!("--- Example 2: Link Mapping/Discovery ---");
39
40 let url = "https://example.com";
41 println!("Mapping links from: {}", url);
42
43 let options = MapOptions::new()
44 .with_link_types(vec!["internal".to_string(), "external".to_string()])
45 .with_base_url(url.to_string())
46 .with_filter_extensions(vec![".html".to_string(), ".htm".to_string()]);
47
48 let response = BlessCrawl::default()
49 .map(url, Some(options))
50 .expect("Failed to map");
51 println!("response: {:?}", response);
52 println!();
53 println!(
54 "------------ links ------------\n{:?}\n------------------------------",
55 response.data.links
56 );
57 println!();
58 println!(
59 "------------ total links ------------\n{}\n------------------------------",
60 response.data.total_links
61 );
62}Sourcepub fn with_link_types(self, link_types: Vec<String>) -> Self
pub fn with_link_types(self, link_types: Vec<String>) -> Self
Examples found in repository?
examples/web-scrape.rs (line 44)
37fn example_mapping() {
38 println!("--- Example 2: Link Mapping/Discovery ---");
39
40 let url = "https://example.com";
41 println!("Mapping links from: {}", url);
42
43 let options = MapOptions::new()
44 .with_link_types(vec!["internal".to_string(), "external".to_string()])
45 .with_base_url(url.to_string())
46 .with_filter_extensions(vec![".html".to_string(), ".htm".to_string()]);
47
48 let response = BlessCrawl::default()
49 .map(url, Some(options))
50 .expect("Failed to map");
51 println!("response: {:?}", response);
52 println!();
53 println!(
54 "------------ links ------------\n{:?}\n------------------------------",
55 response.data.links
56 );
57 println!();
58 println!(
59 "------------ total links ------------\n{}\n------------------------------",
60 response.data.total_links
61 );
62}Sourcepub fn with_base_url(self, base_url: String) -> Self
pub fn with_base_url(self, base_url: String) -> Self
Examples found in repository?
examples/web-scrape.rs (line 45)
37fn example_mapping() {
38 println!("--- Example 2: Link Mapping/Discovery ---");
39
40 let url = "https://example.com";
41 println!("Mapping links from: {}", url);
42
43 let options = MapOptions::new()
44 .with_link_types(vec!["internal".to_string(), "external".to_string()])
45 .with_base_url(url.to_string())
46 .with_filter_extensions(vec![".html".to_string(), ".htm".to_string()]);
47
48 let response = BlessCrawl::default()
49 .map(url, Some(options))
50 .expect("Failed to map");
51 println!("response: {:?}", response);
52 println!();
53 println!(
54 "------------ links ------------\n{:?}\n------------------------------",
55 response.data.links
56 );
57 println!();
58 println!(
59 "------------ total links ------------\n{}\n------------------------------",
60 response.data.total_links
61 );
62}Sourcepub fn with_filter_extensions(self, extensions: Vec<String>) -> Self
pub fn with_filter_extensions(self, extensions: Vec<String>) -> Self
Examples found in repository?
examples/web-scrape.rs (line 46)
37fn example_mapping() {
38 println!("--- Example 2: Link Mapping/Discovery ---");
39
40 let url = "https://example.com";
41 println!("Mapping links from: {}", url);
42
43 let options = MapOptions::new()
44 .with_link_types(vec!["internal".to_string(), "external".to_string()])
45 .with_base_url(url.to_string())
46 .with_filter_extensions(vec![".html".to_string(), ".htm".to_string()]);
47
48 let response = BlessCrawl::default()
49 .map(url, Some(options))
50 .expect("Failed to map");
51 println!("response: {:?}", response);
52 println!();
53 println!(
54 "------------ links ------------\n{:?}\n------------------------------",
55 response.data.links
56 );
57 println!();
58 println!(
59 "------------ total links ------------\n{}\n------------------------------",
60 response.data.total_links
61 );
62}Trait Implementations§
Source§impl Clone for MapOptions
impl Clone for MapOptions
Source§fn clone(&self) -> MapOptions
fn clone(&self) -> MapOptions
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MapOptions
impl Debug for MapOptions
Source§impl Default for MapOptions
impl Default for MapOptions
Source§fn default() -> MapOptions
fn default() -> MapOptions
Returns the “default value” for a type. Read more
Source§impl PartialEq for MapOptions
impl PartialEq for MapOptions
Source§impl Serialize for MapOptions
impl Serialize for MapOptions
impl StructuralPartialEq for MapOptions
Auto Trait Implementations§
impl Freeze for MapOptions
impl RefUnwindSafe for MapOptions
impl Send for MapOptions
impl Sync for MapOptions
impl Unpin for MapOptions
impl UnwindSafe for MapOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more