pub struct ServerConn { /* private fields */ }Expand description
Outbound server-side connection driver.
The struct owns the transport-bound Conn plus the receiving
half of the request channel that feeds it.
Implementations§
Source§impl ServerConn
impl ServerConn
Sourcepub fn new(
conn: Conn,
requests: Receiver<OutboundRequest>,
data_store: DataStore,
) -> Self
pub fn new( conn: Conn, requests: Receiver<OutboundRequest>, data_store: DataStore, ) -> Self
Wrap an outbound Conn with the given request-channel
receiver and data-store flavor.
§Examples
use dynomite::conf::DataStore;
use dynomite::io::reactor::{ConnRole, TcpTransport};
use dynomite::net::{Conn, ServerConn};
use tokio::sync::mpsc;
let s = tokio::net::TcpStream::connect("127.0.0.1:6379").await.unwrap();
let conn = Conn::new(Box::new(TcpTransport::new(s, ConnRole::Server)), ConnRole::Server);
let (_tx, rx) = mpsc::channel(8);
let _ = ServerConn::new(conn, rx, DataStore::Redis);Auto Trait Implementations§
impl Freeze for ServerConn
impl !RefUnwindSafe for ServerConn
impl Send for ServerConn
impl !Sync for ServerConn
impl Unpin for ServerConn
impl UnsafeUnpin for ServerConn
impl !UnwindSafe for ServerConn
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more