#tcp-server #server #tcp #web

bin+lib rust_tcp_sever

A simple and lightweight crate for launching and using a server

12 releases

new 0.2.1 Nov 5, 2024
0.2.0 Oct 9, 2024
0.1.9 Sep 21, 2024
0.1.8 Aug 17, 2024
0.1.6 Jul 28, 2024

#279 in HTTP server

Download history 228/week @ 2024-07-16 341/week @ 2024-07-23 56/week @ 2024-07-30 85/week @ 2024-08-06 188/week @ 2024-08-13 10/week @ 2024-08-20 1/week @ 2024-08-27 11/week @ 2024-09-10 170/week @ 2024-09-17 18/week @ 2024-09-24 16/week @ 2024-10-01 196/week @ 2024-10-08 6/week @ 2024-10-15

221 downloads per month

MIT license

30KB
465 lines

Rust TcpSever

Rust TcpSever is a simple and lightweight crate for launching and using a server.

github.com license crates.io Documentation

Supported Protocols

Usage example:

Cargo.toml:

[dependencies]
rust_tcp_sever = "0.2.1"

src/main.rs:

extern crate rust_tcp_sever;
pub use rust_tcp_sever::*;

fn main() {
   Server::http_launch(TcpListener::bind("127.0.0.1:80").unwrap(), 4);
}

struct Server;

impl HttpControl for Server {
   const FN_READ: HttpRead = HttpServer::read;
   const FN_WRITE: HttpWrite = HttpServer::write;

   #[inline]
   fn check_stream(_stream: &TcpStream) -> bool { true }

   #[inline]
   fn parser_request(_stream: &TcpStream, request: &Request, response: &mut Response) {
       println!("{request:#?}");
       println!("{response:#?}");
   }
}

Future of the Library

The library will be updated as new proposals and ideas are received. I will try to post a new update every month.

Contact Information

License

This project is licensed under the MIT license.

Dependencies

~10KB