#tcp-server #server #tcp #web

bin+lib rust_tcp_sever

A simple and lightweight crate for launching and using a server

13 releases

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

#320 in HTTP server

Download history 77/week @ 2024-07-29 64/week @ 2024-08-05 204/week @ 2024-08-12 14/week @ 2024-08-19 2/week @ 2024-08-26 176/week @ 2024-09-16 20/week @ 2024-09-23 18/week @ 2024-09-30 193/week @ 2024-10-07 10/week @ 2024-10-14 126/week @ 2024-11-04 56/week @ 2024-11-11

182 downloads per month

MIT license

27KB
450 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 examples:

Cargo.toml:

[dependencies]
rust_tcp_sever = "0.2.2"

src/main.rs:

use rust_tcp_sever::*;

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

struct Server;

impl HttpControl for Server {
    #[inline]
    fn check_stream(stream: &TcpStream) -> bool { true }

    #[inline]
    fn parser_request(_stream: &TcpStream, request: &Request, response: &mut Response) { 
        println!("{request:#?}");
        println!("\n\n\n\n");
        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.

License

This project is licensed under the MIT license.

Dependencies

~10KB