rename server2 -> server

This commit is contained in:
sfja 2026-04-09 15:21:43 +02:00
parent 5f231954ef
commit 3832482cd5
5 changed files with 11 additions and 12 deletions

View File

@ -1,6 +1,6 @@
#include "json.hpp"
#include "mqtt.hpp"
#include "server2.hpp"
#include "server.hpp"
#include <print>
#include <stdexcept>
#include <string_view>
@ -29,7 +29,7 @@ int main(void)
auto mqtt_client = mst::mqtt::Client(
BACKEND_MQTT_HOST, BACKEND_MQTT_PORT, "test", "1234");
auto server = mst::server2::Server();
auto server = mst::server::Server();
mqtt_client.subscribe("/skateboard/update", [&](std::string_view text) {
std::println("Skateboard sent: {}", text);

View File

@ -1,7 +1,6 @@
#include "server2.hpp"
#include "server.hpp"
#include <algorithm>
#include <cerrno>
#include <cstdint>
#include <cstring>
#include <format>
#include <iterator>
@ -16,7 +15,7 @@
#include <vector>
namespace {
using namespace mst::server2;
using namespace mst::server;
struct ReqHeader {
enum ReqTy {
@ -77,7 +76,7 @@ auto get_listener_socket() -> int
}
namespace mst::server2 {
namespace mst::server {
struct Server::State {
std::mutex mx;

View File

@ -3,7 +3,7 @@
#include <memory>
#include <stdexcept>
namespace mst::server2 {
namespace mst::server {
struct Error : public std::runtime_error {
using std::runtime_error::runtime_error;

View File

@ -1,7 +1,7 @@
#![allow(dead_code)]
mod engine;
mod server2;
mod server;
use core::panic;
use std::{
@ -14,7 +14,7 @@ use std::{
use crate::{
engine::{Color, Key, Renderer, Scene, Shape, V2, V3},
server2::Server2,
server::Server,
};
struct Skateboard {
@ -388,7 +388,7 @@ impl ShapeGroup {
fn main() -> Result<(), Box<dyn std::error::Error>> {
let t = thread::spawn(|| {
let mut server = Server2::new().unwrap();
let mut server = Server::new().unwrap();
server
.subscribe(|measurement| {
println!("angle = {}", measurement.angle);

View File

@ -21,11 +21,11 @@ pub struct Measurement {
pub angle: f64,
}
pub struct Server2 {
pub struct Server {
stream: TcpStream,
}
impl Server2 {
impl Server {
pub fn new() -> io::Result<Self> {
Ok(Self {
stream: TcpStream::connect("127.0.0.1:8889")?,