add initial client tests (#25)

This commit is contained in:
João Oliveira
2020-04-06 04:57:45 +01:00
committed by GitHub
parent 83cdedf34f
commit e7f6a372f0
3 changed files with 96 additions and 1 deletions

View File

@@ -187,6 +187,11 @@ pub struct Subscriber {
impl Subscriber {
/// get the list of subscribed channels
pub fn get_subscribed(&self) -> &HashSet<String> {
&self.subscribed_channels
}
/// await for next message published on the subscribed channels
pub async fn next_message(&mut self) -> crate::Result<Message> {
match self.receive_message().await {

View File

@@ -182,7 +182,7 @@ pub async fn run(listener: TcpListener, shutdown: impl Future) -> crate::Result<
}
// Extract the `shutdown_complete` receiver and transmitter
// ` explicitly drop shutdown_transmitter`. This is important, as the
// explicitly drop `shutdown_transmitter`. This is important, as the
// `.await` below would otherwise never complete.
let Listener { mut shutdown_complete_rx, shutdown_complete_tx, .. } = server;