Trait Source

Source
pub trait Source<T> {
    // Required methods
    fn init<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn next<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = StreamResult<Option<Record<T>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn close<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Source trait defines the interface for data sources

Required Methods§

Source

fn init<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Initialize the source

Source

fn next<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = StreamResult<Option<Record<T>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read the next record from the source

Source

fn close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = StreamResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Close the source and release resources

Implementors§

Source§

impl Source<String> for CsvSource

Source§

impl<T, F> Source<T> for GeneratorSource<T, F>
where T: Send, F: FnMut() -> Option<T> + Send + Sync,