Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.
use futures::{Stream, StreamExt, TryStream, future::ready};
use crate::{Error, Result};
pub trait TryIgnore<'a, Item> {
fn ignore_err(self) -> impl Stream<Item = Item> + Send + 'a;
fn ignore_ok(self) -> impl Stream<Item = Error> + Send + 'a;
}
impl<'a, T, Item> TryIgnore<'a, Item> for T
where
T: Stream<Item = Result<Item>> + TryStream + Send + 'a,
Item: Send + 'a,
{
#[cfg(debug_assertions)]
#[inline]
fn ignore_err(self: T) -> impl Stream<Item = Item> + Send + 'a {
use super::TryExpect;
self.expect_ok()
#[cfg(not(debug_assertions))]
self.filter_map(|res| ready(res.ok()))
fn ignore_ok(self: T) -> impl Stream<Item = Error> + Send + 'a {
self.filter_map(|res| ready(res.err()))