Trait NetworkService

Source
pub trait NetworkService:
    Send
    + Sync
    + Debug {
    // Required methods
    fn fetch<'life0, 'async_trait>(
        &'life0 self,
        req: FetchRequest,
    ) -> Pin<Box<dyn Future<Output = Result<BytesResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn read_file<'life0, 'async_trait>(
        &'life0 self,
        req: ReadFileRequest,
    ) -> Pin<Box<dyn Future<Output = Result<BytesResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

IPC-facing network service trait. Methods mirror crate::network APIs.

Required Methods§

Source

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

Fetch bytes from a URL (http/https).

Delegates to the underlying networking backend.

Source

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

Read a local file into memory.

Delegates to the underlying networking backend.

Implementors§