mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 15:01:45 +01:00
Make setup_ctrlc_handler
return &mut Self
This commit is contained in:
parent
b11e5fdd19
commit
d89eeb5847
1 changed files with 3 additions and 1 deletions
|
@ -238,7 +238,7 @@ where
|
||||||
/// [`shutdown`]: ShutdownToken::shutdown
|
/// [`shutdown`]: ShutdownToken::shutdown
|
||||||
#[cfg(feature = "ctrlc_handler")]
|
#[cfg(feature = "ctrlc_handler")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "ctrlc_handler")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "ctrlc_handler")))]
|
||||||
pub fn setup_ctrlc_handler(&mut self) {
|
pub fn setup_ctrlc_handler(&mut self) -> &mut Self {
|
||||||
let state = Arc::clone(&self.state);
|
let state = Arc::clone(&self.state);
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
loop {
|
loop {
|
||||||
|
@ -258,6 +258,8 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a shutdown token, which can later be used to shutdown
|
/// Returns a shutdown token, which can later be used to shutdown
|
||||||
|
|
Loading…
Reference in a new issue