This commit is contained in:
parent
ac8812be2f
commit
29ff12f115
7 changed files with 111 additions and 69 deletions
|
|
@ -1,5 +1,6 @@
|
|||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
use async_trait::async_trait;
|
||||
use tokio::{io::AsyncWriteExt, net::TcpStream};
|
||||
use tracing::Instrument;
|
||||
|
||||
|
|
@ -64,7 +65,7 @@ pub async fn send_disconnect(
|
|||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
pub trait MinecraftServerHandle: Clone {
|
||||
pub trait MinecraftServerHandle: Send + Sync + 'static + Clone {
|
||||
async fn start(&self) -> Result<(), OpaqueError>;
|
||||
async fn stop(&self) -> Result<(), OpaqueError>;
|
||||
async fn query_status(&self) -> Result<ServerDeploymentStatus, OpaqueError>;
|
||||
|
|
@ -156,7 +157,8 @@ pub trait MinecraftServerHandle: Clone {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait MinecraftAPI<T> {
|
||||
#[async_trait]
|
||||
pub trait MinecraftAPI<T>: Send + Sync + 'static {
|
||||
async fn query_server(&self, addr: &str, port: &str) -> Result<T, OpaqueError>;
|
||||
fn get_map(&self) -> Arc<tokio::sync::Mutex<HashMap<String, tokio::task::JoinHandle<()>>>>;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue