rs-netty 0.2.0

A Tokio-native typed TCP/UDP pipeline framework inspired by Netty.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::future;

use tokio::sync::watch;

pub(crate) fn requested(shutdown_rx: &Option<watch::Receiver<bool>>) -> bool {
    shutdown_rx
        .as_ref()
        .is_some_and(|shutdown_rx| *shutdown_rx.borrow())
}

pub(crate) async fn wait(shutdown_rx: &mut Option<watch::Receiver<bool>>) {
    let Some(shutdown_rx) = shutdown_rx else {
        future::pending::<()>().await;
        return;
    };

    let _ = shutdown_rx.changed().await;
}