pub struct FeedOption {
pub origin: String,
pub label: String,
pub max_length: usize,
pub fetch_length: usize,
pub interval: u64,
pub idle_limit: u64,
pub sort: bool,
pub extractor: Vec<String>,
pub fetch: bool,
pub channel: PseudoChannel,
}Expand description
Specific scraping options for a single feed
Fields§
§origin: StringURL to fetch
label: StringText label of the feed
max_length: usizeMax feed item length
fetch_length: usizeMax length to fetch per interval
interval: u64Interval between fetching
idle_limit: u64Duration of no requests before scraping stops
sort: boolTo sort items by publish date or not
extractor: Vec<String>Scraper script
fetch: bool§channel: PseudoChannelChannel details
Implementations§
Source§impl FeedOption
impl FeedOption
pub async fn meta(&self) -> Result<FetchedMeta, Box<dyn Error>>
Sourcepub async fn lazy_fetch_rss(&self) -> Result<String, Box<dyn Error>>
pub async fn lazy_fetch_rss(&self) -> Result<String, Box<dyn Error>>
Fetch rss (xml) string from either remote or cache
Sourcepub async fn force_fetch_rss(&self) -> Result<String, Box<dyn Error>>
pub async fn force_fetch_rss(&self) -> Result<String, Box<dyn Error>>
Fetch rss (xml) string from remote
Sourcepub async fn lazy_fetch_json(&self) -> Result<String, Box<dyn Error>>
pub async fn lazy_fetch_json(&self) -> Result<String, Box<dyn Error>>
Fetch json string from either remote or cache
Sourcepub async fn force_fetch_json(&self) -> Result<String, Box<dyn Error>>
pub async fn force_fetch_json(&self) -> Result<String, Box<dyn Error>>
Fetch json string from remote
Sourcepub async fn lazy_fetch(&self) -> Result<PseudoChannel, Box<dyn Error>>
pub async fn lazy_fetch(&self) -> Result<PseudoChannel, Box<dyn Error>>
Fetch a feed either from remote or a cached version
Sourcepub async fn force_fetch(&self) -> Result<PseudoChannel, Box<dyn Error>>
pub async fn force_fetch(&self) -> Result<PseudoChannel, Box<dyn Error>>
Fetch a feed and saves metadata
Sourcepub fn outdated(&self, meta: &FetchedMeta) -> bool
pub fn outdated(&self, meta: &FetchedMeta) -> bool
Check if a feed is outdated
Sourcepub fn time_til_outdated(&self, meta: &FetchedMeta) -> Option<u64>
pub fn time_til_outdated(&self, meta: &FetchedMeta) -> Option<u64>
Number of seconds before feed will become outdated
Sourcepub fn idle(&self, meta: &FetchedMeta) -> bool
pub fn idle(&self, meta: &FetchedMeta) -> bool
Check if a feed has passed the idle limit
Trait Implementations§
Source§impl Clone for FeedOption
impl Clone for FeedOption
Source§fn clone(&self) -> FeedOption
fn clone(&self) -> FeedOption
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FeedOption
impl Debug for FeedOption
Source§impl Default for FeedOption
impl Default for FeedOption
Source§impl<'de> Deserialize<'de> for FeedOption
impl<'de> Deserialize<'de> for FeedOption
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for FeedOption
impl RefUnwindSafe for FeedOption
impl Send for FeedOption
impl Sync for FeedOption
impl Unpin for FeedOption
impl UnwindSafe for FeedOption
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