mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-06-14 11:42:02 +08:00
35 lines
732 B
Rust
35 lines
732 B
Rust
use async_trait::async_trait;
|
|
use std::time::Duration;
|
|
|
|
use super::traits::AtxKeyBackend;
|
|
use crate::error::{AppError, Result};
|
|
|
|
pub struct DisabledAtxKeyBackend {
|
|
reason: &'static str,
|
|
}
|
|
|
|
impl DisabledAtxKeyBackend {
|
|
pub fn new(reason: &'static str) -> Self {
|
|
Self { reason }
|
|
}
|
|
}
|
|
|
|
#[async_trait]
|
|
impl AtxKeyBackend for DisabledAtxKeyBackend {
|
|
async fn init(&mut self) -> Result<()> {
|
|
Err(AppError::Internal(self.reason.to_string()))
|
|
}
|
|
|
|
async fn pulse(&self, _duration: Duration) -> Result<()> {
|
|
Err(AppError::Internal(self.reason.to_string()))
|
|
}
|
|
|
|
async fn shutdown(&mut self) -> Result<()> {
|
|
Ok(())
|
|
}
|
|
|
|
fn is_initialized(&self) -> bool {
|
|
false
|
|
}
|
|
}
|