refactor: 调整模块位置

This commit is contained in:
Del Wang
2026-01-02 10:22:16 +08:00
parent 4d459afd28
commit ef28121f5d
15 changed files with 72 additions and 14 deletions
@@ -0,0 +1,8 @@
#![cfg(target_os = "linux")]
use anyhow::Result;
pub async fn run_client() -> Result<()> {
println!("Hello, Client!");
Ok(())
}
+1
View File
@@ -0,0 +1 @@
pub mod entry;
+3 -3
View File
@@ -1,3 +1,3 @@
pub mod entry;
pub mod master;
pub mod slave;
pub mod client;
pub mod server;
pub mod stereo;
@@ -0,0 +1,6 @@
use anyhow::Result;
pub async fn run_server() -> Result<()> {
println!("Hello, Server!");
Ok(())
}
+1
View File
@@ -0,0 +1 @@
pub mod entry;
@@ -6,7 +6,7 @@ use crate::net::protocol::ChannelRole;
use anyhow::Result;
use std::env;
pub async fn run_xiao() -> Result<()> {
pub async fn run_stereo() -> Result<()> {
let args: Vec<String> = env::args().collect();
if args.len() < 3 {
eprintln!("用法: {} [master|slave] [left|right]", args[0]);
+3
View File
@@ -0,0 +1,3 @@
pub mod entry;
pub mod master;
pub mod slave;
+6 -3
View File
@@ -2,10 +2,13 @@ use anyhow::Result;
#[tokio::main]
async fn main() -> Result<()> {
#[cfg(target_os = "linux")]
#[cfg(feature = "app")]
{
xiao::app::entry::run_xiao().await.unwrap();
xiao::app::client::entry::run_client().await?;
}
#[cfg(not(target_os = "linux"))]
{
eprintln!("Only support Linux");
}
println!("Only support Linux");
Ok(())
}
+10
View File
@@ -0,0 +1,10 @@
use anyhow::Result;
#[tokio::main]
async fn main() -> Result<()> {
#[cfg(feature = "app")]
{
xiao::app::server::entry::run_server().await?;
}
Ok(())
}
+14
View File
@@ -0,0 +1,14 @@
use anyhow::Result;
#[tokio::main]
async fn main() -> Result<()> {
#[cfg(feature = "app")]
{
xiao::app::stereo::entry::run_stereo().await?;
}
#[cfg(not(target_os = "linux"))]
{
eprintln!("Only support Linux");
}
Ok(())
}
+3 -1
View File
@@ -1,4 +1,6 @@
pub mod app;
pub mod audio;
pub mod net;
pub mod utils;
#[cfg(feature = "app")]
pub mod app;