1
0
mirror of https://github.com/actix/examples synced 2025-06-26 17:17:42 +02:00

chore: fmt

This commit is contained in:
Rob Ede
2025-03-21 06:07:31 +00:00
parent a7527d72f3
commit 04f8cba71b
98 changed files with 828 additions and 650 deletions

View File

@ -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();

View File

@ -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;

View File

@ -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;