Mercurial > templog
diff rust/src/types.rs @ 633:490e9e15b98c rust
move some bits to riker
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 04 Sep 2019 23:24:13 +0800 |
parents | efcbe0d3afd6 |
children | a5721c02d3ee |
line wrap: on
line diff
--- a/rust/src/types.rs Thu Aug 22 23:59:50 2019 +0800 +++ b/rust/src/types.rs Wed Sep 04 23:24:13 2019 +0800 @@ -5,10 +5,9 @@ use std::io; use std::cmp; use std::cell::Cell; -use std::iter::FromIterator; + use std; -use futures::{Stream,IntoFuture}; use serde::{Deserialize,Serialize}; use toml; use hyper; @@ -57,7 +56,7 @@ &self.desc } - fn cause(&self) -> Option<&Error> { + fn cause(&self) -> Option<&dyn Error> { match self.kind { TemplogErrorKind::None => None, TemplogErrorKind::Io(ref e) => Some(e), @@ -268,22 +267,3 @@ } } -/// Takes a stream and returns a stream without errors. -pub fn consume_errors<S>(s: S) -> Box<Stream<Item=S::Item, Error=S::Error>> - where - S: Stream+Send+'static, - <S as Stream>::Error: std::fmt::Display+Send+'static, - <S as Stream>::Item: Send+'static, -{ - let f = s.then(|r| { - match r { - Ok(v) => Ok(Some(v)), - Err(e) => { - debug!("Stream error: {}", e); - Ok(None) - } - } - }) - .filter_map(|p| p); - Box::new(f) -}