pub async fn load_async<R>(mut data: R, format: ImageFormat) -> Result<Self>
    where
        R: AsyncRead + Unpin,
    {
        let mut buf = vec![];
        data.read_to_end(&mut buf).await?;
        Self::from_bytes(&buf, format)
    }
/// Load an image from a `AsyncRead` instance which emits image file data in the
/// specified format.
///
/// # Example
///
/// ```
/// # use riddle_image::*; fn main() -> Result<(), ImageError> { futures::executor::block_on(async_main()) }
/// # async fn async_main() -> Result<(), ImageError> {
/// let png_bytes = include_bytes!("../../example_assets/image.png");
/// let png_img = Image::load_async(&png_bytes[..], ImageFormat::Png).await?;
/// # Ok(()) }
/// ```
Load an image from a `AsyncRead` instance which emits image file data in the
specified format.
Load an image from a ` AsyncRead ` instance which emits image file data in the specified format .
pub async fn load_async<R>(mut data: R, format: ImageFormat) -> Result<Self>
    where
        R: AsyncRead + Unpin,
    {
        let mut buf = vec![];
        data.read_to_end(&mut buf).await?;
        Self::from_bytes(&buf, format)
    }
pub async fn load_async < R > ( mut data : R , format : ImageFormat ) -> Result < Self > where R : AsyncRead + Unpin , { let mut buf = vec ! [ ] ; data . read_to_end ( & mut buf ) . await ? ; Self :: from_bytes ( & buf , format ) }
Load an image from a `AsyncRead` instance which emits image file data in the
specified format.
Load an image from a ` AsyncRead ` instance which emits image file data in the specified format .
data
R
format
ImageFormat
data
R
format
ImageFormat
example
None
use riddle_image::*; fn main() -> result<(), imageerror> { futures::executor::block_on(async_main()) }
None
async fn async_main() -> result<(), imageerror> {
let png_bytes = include_bytes!("../../example_assets/image.png");
let png_img = Image::load_async(&png_bytes[..], ImageFormat::Png).await?.
let png_bytes = include_bytes! ( " .. / .. / example_assets / image . png " ) ; let png_img = Image :: load_async ( &png_bytes [ .. ] ImageFormat :: Png ) . await? .
ok(()) }
None