39 lines
885 B
Rust
39 lines
885 B
Rust
use bytes::Bytes;
|
|
use crossbeam_channel::{Receiver, Sender};
|
|
use tokio::runtime::Runtime;
|
|
|
|
pub struct ServerConnection {
|
|
pub rx: Receiver<Bytes>,
|
|
pub cx: Sender<Bytes>,
|
|
}
|
|
|
|
impl ServerConnection {
|
|
pub fn new() -> Self {
|
|
let (cx, rx) = crossbeam_channel::unbounded();
|
|
ServerConnection {
|
|
cx,
|
|
rx,
|
|
}
|
|
}
|
|
}
|
|
|
|
pub struct NetworkingRuntime(pub(crate) Runtime);
|
|
|
|
pub struct NetworkingRuntimeMessenger {
|
|
pub rx: Receiver<NetworkingRuntimeHandlerSignals>,
|
|
pub cx: Sender<NetworkingRuntimeHandlerSignals>,
|
|
}
|
|
|
|
impl NetworkingRuntimeMessenger {
|
|
pub fn new() -> Self {
|
|
let (cx, rx) = crossbeam_channel::unbounded();
|
|
NetworkingRuntimeMessenger {
|
|
cx,
|
|
rx
|
|
}
|
|
}
|
|
}
|
|
|
|
pub enum NetworkingRuntimeHandlerSignals {
|
|
KILL, //Don't have any other signals as of now, may want more later
|
|
} |