futures_rx/stream/
notification.rs

1#[derive(Debug)]
2pub enum Notification<T> {
3    Next(T),
4    Complete,
5}
6
7impl<T> Notification<T> {
8    pub fn inner_value(self) -> Option<T> {
9        match self {
10            Notification::Next(it) => Some(it),
11            Notification::Complete => None,
12        }
13    }
14}
15
16impl<T: PartialEq> PartialEq for Notification<T> {
17    fn eq(&self, other: &Self) -> bool {
18        match (self, other) {
19            (Self::Next(l0), Self::Next(r0)) => l0 == r0,
20            _ => core::mem::discriminant(self) == core::mem::discriminant(other),
21        }
22    }
23}
24
25impl<T: Clone> Clone for Notification<T> {
26    fn clone(&self) -> Self {
27        match self {
28            Self::Next(arg0) => Self::Next(arg0.clone()),
29            Self::Complete => Self::Complete,
30        }
31    }
32}