pub struct Tcp {
pub host: String,
pub port: u16,
pub cert: Option<String>,
pub cert_password: Option<String>,
pub capacity: usize,
}Fields§
§host: String§port: u16§cert: Option<String>§cert_password: Option<String>§capacity: usizeTrait Implementations§
Source§impl ServerTrait for Tcp
impl ServerTrait for Tcp
Source§async fn start(&self) -> Result<()>
async fn start(&self) -> Result<()>
Starts the simple pub sub server for the given server type
use simple_pub_sub::server::ServerTrait as _;
// for tcp
async fn run_server_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,
});
let _ = server.start().await;
}
// for tls
async fn run_server_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,
});
let _ = server.start().await;
}Auto Trait Implementations§
impl Freeze for Tcp
impl RefUnwindSafe for Tcp
impl Send for Tcp
impl Sync for Tcp
impl Unpin for Tcp
impl UnwindSafe for Tcp
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