Fix examples depending on tokio::time

This commit is contained in:
bitfl0wer 2023-11-20 00:13:32 +01:00
parent 81091ebcee
commit 0782f257e8
No known key found for this signature in database
GPG Key ID: 0ACD574FCF5226CF
2 changed files with 5 additions and 5 deletions

View File

@ -6,7 +6,7 @@ use chorus::{
types::{GatewayIdentifyPayload, GatewayReady}, types::{GatewayIdentifyPayload, GatewayReady},
}; };
use std::{sync::Arc, time::Duration}; use std::{sync::Arc, time::Duration};
use tokio::{self, time::sleep}; use tokio::{self};
// This example creates a simple gateway connection and a basic observer struct // This example creates a simple gateway connection and a basic observer struct
@ -54,9 +54,10 @@ async fn main() {
let mut identify = GatewayIdentifyPayload::common(); let mut identify = GatewayIdentifyPayload::common();
identify.token = token; identify.token = token;
gateway.send_identify(identify).await; gateway.send_identify(identify).await;
safina_timer::start_timer_thread();
// Do something on the main thread so we don't quit // Do something on the main thread so we don't quit
loop { loop {
sleep(Duration::MAX).await; safina_timer::sleep_for(Duration::MAX).await
} }
} }

View File

@ -2,7 +2,6 @@ use std::time::Duration;
use chorus::gateway::Gateway; use chorus::gateway::Gateway;
use chorus::{self, types::GatewayIdentifyPayload}; use chorus::{self, types::GatewayIdentifyPayload};
use tokio::time::sleep;
/// This example creates a simple gateway connection and a session with an Identify event /// This example creates a simple gateway connection and a session with an Identify event
#[tokio::main(flavor = "current_thread")] #[tokio::main(flavor = "current_thread")]
@ -27,10 +26,10 @@ async fn main() {
identify.token = token; identify.token = token;
// Send off the event // Send off the event
gateway.send_identify(identify).await; safina_timer::start_timer_thread();
// Do something on the main thread so we don't quit // Do something on the main thread so we don't quit
loop { loop {
sleep(Duration::MAX).await; safina_timer::sleep_for(Duration::MAX).await
} }
} }