mirror of
https://github.com/actix/examples
synced 2025-06-26 17:17:42 +02:00
chore: fmt
This commit is contained in:
@ -16,20 +16,22 @@ async fn main() {
|
||||
let mut cmd_rx = UnboundedReceiverStream::new(cmd_rx);
|
||||
|
||||
// run blocking terminal input reader on separate thread
|
||||
let input_thread = thread::spawn(move || loop {
|
||||
let mut cmd = String::with_capacity(32);
|
||||
let input_thread = thread::spawn(move || {
|
||||
loop {
|
||||
let mut cmd = String::with_capacity(32);
|
||||
|
||||
if io::stdin().read_line(&mut cmd).is_err() {
|
||||
log::error!("error reading line");
|
||||
return;
|
||||
if io::stdin().read_line(&mut cmd).is_err() {
|
||||
log::error!("error reading line");
|
||||
return;
|
||||
}
|
||||
|
||||
if cmd.trim() == "/exit" {
|
||||
println!("exiting input loop");
|
||||
return;
|
||||
}
|
||||
|
||||
cmd_tx.send(cmd).unwrap();
|
||||
}
|
||||
|
||||
if cmd.trim() == "/exit" {
|
||||
println!("exiting input loop");
|
||||
return;
|
||||
}
|
||||
|
||||
cmd_tx.send(cmd).unwrap();
|
||||
});
|
||||
|
||||
let io = TcpStream::connect(("127.0.0.1", 12345)).await.unwrap();
|
||||
|
@ -2,7 +2,7 @@ use std::time::{Duration, Instant};
|
||||
|
||||
use actix::prelude::*;
|
||||
use actix_files::NamedFile;
|
||||
use actix_web::{middleware::Logger, web, App, Error, HttpRequest, HttpServer, Responder};
|
||||
use actix_web::{App, Error, HttpRequest, HttpServer, Responder, middleware::Logger, web};
|
||||
use actix_web_actors::ws;
|
||||
|
||||
mod codec;
|
||||
|
@ -9,7 +9,7 @@ use std::{
|
||||
|
||||
use actix::{prelude::*, spawn};
|
||||
use tokio::{
|
||||
io::{split, WriteHalf},
|
||||
io::{WriteHalf, split},
|
||||
net::{TcpListener, TcpStream},
|
||||
};
|
||||
use tokio_util::codec::FramedRead;
|
||||
|
Reference in New Issue
Block a user