FeedOption

Struct FeedOption 

Source
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: String

URL to fetch

§label: String

Text label of the feed

§max_length: usize

Max feed item length

§fetch_length: usize

Max length to fetch per interval

§interval: u64

Interval between fetching

§idle_limit: u64

Duration of no requests before scraping stops

§sort: bool

To sort items by publish date or not

§extractor: Vec<String>

Scraper script

§fetch: bool§channel: PseudoChannel

Channel details

Implementations§

Source§

impl FeedOption

Source

pub fn validate(&self)

Check if the extractor command is valid (not empty)

Source

pub async fn meta(&self) -> Result<FetchedMeta, Box<dyn Error>>

Source

pub async fn lazy_fetch_rss(&self) -> Result<String, Box<dyn Error>>

Fetch rss (xml) string from either remote or cache

Source

pub async fn force_fetch_rss(&self) -> Result<String, Box<dyn Error>>

Fetch rss (xml) string from remote

Source

pub async fn lazy_fetch_json(&self) -> Result<String, Box<dyn Error>>

Fetch json string from either remote or cache

Source

pub async fn force_fetch_json(&self) -> Result<String, Box<dyn Error>>

Fetch json string from remote

Source

pub async fn lazy_fetch(&self) -> Result<PseudoChannel, Box<dyn Error>>

Fetch a feed either from remote or a cached version

Source

pub async fn force_fetch(&self) -> Result<PseudoChannel, Box<dyn Error>>

Fetch a feed and saves metadata

Source

pub fn outdated(&self, meta: &FetchedMeta) -> bool

Check if a feed is outdated

Source

pub fn time_til_outdated(&self, meta: &FetchedMeta) -> Option<u64>

Number of seconds before feed will become outdated

Source

pub fn idle(&self, meta: &FetchedMeta) -> bool

Check if a feed has passed the idle limit

Trait Implementations§

Source§

impl Clone for FeedOption

Source§

fn clone(&self) -> FeedOption

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FeedOption

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FeedOption

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for FeedOption

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for FeedOption

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,