PlatformService

Trait PlatformService 

Source
pub trait PlatformService {
    // Required methods
    fn new() -> Self;
    fn load_image_url<'life0, 'life1, 'async_trait>(
        &'life0 self,
        url: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<DecodedImage, GalileoError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn load_bytes_from_url<'life0, 'life1, 'async_trait>(
        &'life0 self,
        url: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Bytes, GalileoError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn decode_image<'life0, 'async_trait>(
        &'life0 self,
        imaage_data: Bytes,
    ) -> Pin<Box<dyn Future<Output = Result<DecodedImage, GalileoError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Service providing some platform specific functions in a generic way.

Required Methods§

Source

fn new() -> Self

Creates a new instance of the service. This method is a part of the trait to allow other types be agnostic of the specific type of the platform service they work with.

Source

fn load_image_url<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<DecodedImage, GalileoError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Loads and decodes an image from the given url.

Source

fn load_bytes_from_url<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Bytes, GalileoError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Loads a byte array from the given url.

Source

fn decode_image<'life0, 'async_trait>( &'life0 self, imaage_data: Bytes, ) -> Pin<Box<dyn Future<Output = Result<DecodedImage, GalileoError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Decodes an image from raw byte data

Raw bytes may contain in any supported format. The list of formats depends on the platform.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§