Browse Source

up gitignore

master
Igor Elpin 2 years ago
parent
commit
d853f96cf1
  1. 2
      .gitignore
  2. 2
      .idea/rust.iml
  3. 3
      first-app-00/src/main.rs
  4. 2
      simple/Cargo.lock
  5. 2
      simple/Cargo.toml
  6. 24
      simple/src/main.rs

2
.gitignore vendored

@ -1,4 +1,4 @@
# Default ignored files
/shelf/
/.idea/workspace.xml
target/*
*/target/

2
.idea/rust.iml

@ -4,7 +4,9 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/first-app-00/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/simple/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/first-app-00/target" />
<excludeFolder url="file://$MODULE_DIR$/simple/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />

3
first-app-00/src/main.rs

@ -1,3 +0,0 @@
fn main() {
println!("Hello, world!");
}

2
first-app-00/Cargo.lock → simple/Cargo.lock generated

@ -3,5 +3,5 @@
version = 3
[[package]]
name = "first-app-00"
name = "simple"
version = "0.1.0"

2
first-app-00/Cargo.toml → simple/Cargo.toml

@ -1,5 +1,5 @@
[package]
name = "first-app-00"
name = "simple"
version = "0.1.0"
edition = "2021"

24
simple/src/main.rs

@ -0,0 +1,24 @@
use std:: {
io::{ prelude::*,BufReader},
net::{TcpListener,TcpStream},
};
fn main() {
let listener = TcpListener::bind("127.0.0.1:7878").unwrap();
for stream in listener.incoming() {
let stream= stream.unwrap();
handle_connect(stream)
}
}
fn handle_connect(mut stream: TcpStream) {
let buf_reader = BufReader::new(&mut stream);
let http_request: Vec<_> = buf_reader
.lines()
.map(|result|result.unwrap())
.take_while(|line|!line.is_empty())
.collect();
println!("Request: {:#?}",http_request);
}
Loading…
Cancel
Save