#![warn(missing_docs)]
use std::fmt::Debug;
use std::sync::Arc;
#[cfg(feature = "async-token-source")]
use async_trait::async_trait;
#[cfg(feature = "async-token-source")]
#[async_trait]
pub trait TokenSource: Send + Sync + Debug {
async fn token(&self) -> Result<String, Box<dyn std::error::Error + Send + Sync>>;
}
#[cfg(not(feature = "async-token-source"))]
pub trait TokenSource: Send + Sync + Debug {
fn token(&self) -> Result<String, Box<dyn std::error::Error + Send + Sync>>;
}
pub trait TokenSourceProvider: Send + Sync + Debug {
fn token_source(&self) -> Arc<dyn TokenSource>;
}
#[derive(Debug)]
pub struct NoopTokenSourceProvider {}
impl TokenSourceProvider for NoopTokenSourceProvider {
fn token_source(&self) -> Arc<dyn TokenSource> {
panic!("This is dummy token source provider. Please use any crate providing a real implementation.")
}
}