DataSource

Trait DataSource 

Source
pub trait DataSource: Send + Sync {
    // Required methods
    fn load<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<DataSourceContent>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn check_updated<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn source_type(&self) -> DataSourceType;
}
Expand description

Trait for data source implementations

Required Methods§

Source

fn load<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<DataSourceContent>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load data from the source

Source

fn check_updated<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if the source has been updated (for caching)

Source

fn source_type(&self) -> DataSourceType

Get the source type

Implementors§