image: Allow any kind of data that implements AsRef<[u8]> for the image data
It's not required anywhere for it to be a plain slice or a `Vec` and this makes it possible to use data allocated in a different way without copying.
This commit is contained in:
parent
27ba0be783
commit
d2996f3ed8
2 changed files with 65 additions and 8 deletions
|
|
@ -193,7 +193,7 @@ impl Pokemon {
|
|||
{
|
||||
let bytes = reqwest::get(&url).await?.bytes().await?;
|
||||
|
||||
Ok(image::Handle::from_memory(bytes.as_ref().to_vec()))
|
||||
Ok(image::Handle::from_memory(bytes))
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue