rust_tcp_sever

Crates.iorust_tcp_sever
lib.rsrust_tcp_sever
version0.2.1
sourcesrc
created_at2024-07-19 10:33:58.084793
updated_at2024-11-05 05:32:41.792794
descriptionA simple and lightweight crate for launching and using a server.
homepage
repositoryhttps://github.com/Amakesasha/Rust-TcpSever
max_upload_size
id1308524
size37,779
AmakeSasha (Amakesasha)

documentation

README

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.

Commit count: 30

cargo fmt