| 5513 | type SubscribeWarningStream = NotificationStream<pb::WarningNotification>; |
| 5514 | |
| 5515 | async fn subscribe_warning( |
| 5516 | &self, |
| 5517 | _request : tonic::Request<pb::StreamWarningRequest> |
| 5518 | ) -> Result<tonic::Response<Self::SubscribeWarningStream>, tonic::Status> { |
| 5519 | let receiver = self.events.subscribe(); |
| 5520 | let stream = BroadcastStream::new(receiver); |
| 5521 | let boxed = Box::pin(stream); |
| 5522 | |
| 5523 | let result = NotificationStream { |
| 5524 | inner : boxed, |
| 5525 | fn_filter_map : |x| { |
| 5526 | match x { |
| 5527 | Notification::Warning(x) => { |
| 5528 | Some(x.into()) |
| 5529 | } |
| 5530 | _ => None |
| 5531 | } |
| 5532 | } |
| 5533 | }; |
| 5534 | Ok(tonic::Response::new(result)) |
| 5535 | } |
| 5536 | |
| 5537 | |
| 5538 | type SubscribePayPartEndStream = NotificationStream<pb::PayPartEndNotification>; |