mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
make start return never
This commit is contained in:
parent
421d8ce2c8
commit
ea3e860012
2 changed files with 7 additions and 6 deletions
|
@ -3,6 +3,7 @@
|
||||||
#![feature(type_changing_struct_update)]
|
#![feature(type_changing_struct_update)]
|
||||||
#![feature(lazy_cell)]
|
#![feature(lazy_cell)]
|
||||||
#![feature(let_chains)]
|
#![feature(let_chains)]
|
||||||
|
#![feature(never_type)]
|
||||||
|
|
||||||
pub mod accept_resource_packs;
|
pub mod accept_resource_packs;
|
||||||
pub mod auto_respawn;
|
pub mod auto_respawn;
|
||||||
|
@ -180,7 +181,7 @@ where
|
||||||
mut self,
|
mut self,
|
||||||
account: Account,
|
account: Account,
|
||||||
address: impl TryInto<ServerAddress>,
|
address: impl TryInto<ServerAddress>,
|
||||||
) -> Result<(), StartError> {
|
) -> Result<!, StartError> {
|
||||||
self.swarm.accounts = vec![account];
|
self.swarm.accounts = vec![account];
|
||||||
if self.swarm.states.is_empty() {
|
if self.swarm.states.is_empty() {
|
||||||
self.swarm.states = vec![S::default()];
|
self.swarm.states = vec![S::default()];
|
||||||
|
|
|
@ -292,7 +292,7 @@ where
|
||||||
/// that implements `TryInto<ServerAddress>`.
|
/// that implements `TryInto<ServerAddress>`.
|
||||||
///
|
///
|
||||||
/// [`ServerAddress`]: azalea_protocol::ServerAddress
|
/// [`ServerAddress`]: azalea_protocol::ServerAddress
|
||||||
pub async fn start(self, address: impl TryInto<ServerAddress>) -> Result<(), StartError> {
|
pub async fn start(self, address: impl TryInto<ServerAddress>) -> Result<!, StartError> {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
self.accounts.len(),
|
self.accounts.len(),
|
||||||
self.states.len(),
|
self.states.len(),
|
||||||
|
@ -351,7 +351,7 @@ where
|
||||||
let accounts = self.accounts.clone();
|
let accounts = self.accounts.clone();
|
||||||
let states = self.states.clone();
|
let states = self.states.clone();
|
||||||
|
|
||||||
let join_task = tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
if let Some(join_delay) = join_delay {
|
if let Some(join_delay) = join_delay {
|
||||||
// if there's a join delay, then join one by one
|
// if there's a join delay, then join one by one
|
||||||
for (account, state) in accounts.iter().zip(states) {
|
for (account, state) in accounts.iter().zip(states) {
|
||||||
|
@ -412,9 +412,9 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
join_task.abort();
|
unreachable!(
|
||||||
|
"bots_rx.recv() should never be None because the bots_tx channel is never closed"
|
||||||
Ok(())
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue