[−][src]Function dishub::ops::start_daemon::feeds_filter
pub fn feeds_filter<W: Write>(output: &mut W, f: &Feed) -> bool
A filter function to use upon feeds to be polled.
Examples
let mut out = Vec::new(); let now = Local::now(); let now = now.with_timezone(now.offset()); let feeds = vec![Feed::new("nabijaczleweli".to_string(), 10, 0), Feed { subject: "nabijaczleweli/dishub".to_string(), server: 11, channel: 1, e_tag: Some("4797f0ad2ee145181045fe69c61676e6".to_string()), latest: Some(now), next_min: Some(now + Duration::minutes(1)), latest_event: Some(4831774905), }, Feed { subject: "sehe".to_string(), server: 12, channel: 2, e_tag: Some("62476f13306db1cfade222d41bcdcb51".to_string()), latest: Some(now - Duration::minutes(2)), next_min: Some(now - Duration::minutes(1)), latest_event: Some(4856265369), }]; let new_feeds: Vec<_> = feeds.iter().filter(|f| start_daemon::feeds_filter(&mut out, f)).collect(); assert_eq!(&out[..], &b"Too early to re-poll nabijaczleweli/dishub\n"[..]); assert_eq!(&new_feeds[..], &[&feeds[0], &feeds[2]]);