Fix examples depending on tokio::time
This commit is contained in:
parent
81091ebcee
commit
0782f257e8
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue