mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 15:01:45 +01:00
Replace ShutdownError
with ()
This commit is contained in:
parent
483e544223
commit
0347f9e627
1 changed files with 2 additions and 9 deletions
|
@ -468,22 +468,15 @@ pub struct ShutdownToken {
|
|||
impl ShutdownToken {
|
||||
/// Tries to shutdown dispatching.
|
||||
///
|
||||
/// Returns error if this dispather isn't dispatching at the moment.
|
||||
/// Returns error if this dispather is idle at the moment.
|
||||
///
|
||||
/// If you don't need to wait for shutdown, returned future can be ignored.
|
||||
pub fn shutdown(&self) -> Result<impl Future<Output = ()> + '_, ShutdownError> {
|
||||
pub fn shutdown(&self) -> Result<impl Future<Output = ()> + '_, ()> {
|
||||
shutdown_inner(&self.dispatcher_state)
|
||||
.map(|()| async move { self.shutdown_notify_back.notified().await })
|
||||
}
|
||||
}
|
||||
|
||||
/// Error occured while trying to shutdown dispatcher.
|
||||
#[derive(Debug)]
|
||||
pub enum ShutdownError {
|
||||
/// Couldn"t stop dispatcher since it wasn't running.
|
||||
Idle,
|
||||
}
|
||||
|
||||
struct DispatcherState {
|
||||
inner: AtomicU8,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue