pub enum ServerType {
Tcp(Tcp),
Unix(Unix),
}Variants§
Trait Implementations§
Source§impl ServerTrait for ServerType
impl ServerTrait for ServerType
Source§async fn start(&self) -> Result<()>
async fn start(&self) -> Result<()>
starts the simple-pub-sub server on the given server type
use simple_pub_sub::server::ServerTrait as _;
// for tcp
let server = simple_pub_sub::server::ServerType::Tcp(simple_pub_sub::server::Tcp {
host: "localhost".to_string(),
port: 6480,
cert: None,
cert_password: None,
capacity: 1024,
});
server.start();
// for tls
let server = simple_pub_sub::server::ServerType::Tcp(simple_pub_sub::server::Tcp {
host: "localhost".to_string(),
port: 6480,
cert: Some("certs/cert.pem".to_string()),
cert_password: Some("password".to_string()),
capacity: 1024,
});
server.start();
// for unix socket
use crate::simple_pub_sub::server::ServerTrait as _;
let server = simple_pub_sub::server::ServerType::Unix(simple_pub_sub::server::Unix {
path: "/tmp/sample.sock".to_string(),
capacity: 1024,
});
let result = server.start();Auto Trait Implementations§
impl Freeze for ServerType
impl RefUnwindSafe for ServerType
impl Send for ServerType
impl Sync for ServerType
impl Unpin for ServerType
impl UnwindSafe for ServerType
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