pub struct Server {
pub config: Config,
}
Expand description
RServer’s Server struct.
Fields§
§config: Config
Implementations§
source§impl Server
impl Server
pub fn new(config: Config) -> Self
sourcepub async fn start(self) -> Result<(), Box<dyn Error>>
pub async fn start(self) -> Result<(), Box<dyn Error>>
Start server at the given host and port which will handle requests recieved from clients/apps.
Example
use rserver::Config;
use rserver::Server;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = Config::default();
let server = Server::new(config);
server.start().await
}