Skip to content

Commit

Permalink
wasm: Move to traits
Browse files Browse the repository at this point in the history
Signed-off-by: caleb <[email protected]>
  • Loading branch information
etemesi254 committed Aug 30, 2023
1 parent 5fd6bd6 commit a060766
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions zune-wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ impl WasmImage {
/// or none otherwise
#[wasm_bindgen]
pub fn decode(bytes: &[u8]) -> Option<WasmImage> {
if let Some(format) = ImageFormat::guess_format(bytes) {
if let Ok(mut decoder) = format.get_decoder(bytes) {
if let Some((format, content)) = ImageFormat::guess_format(bytes) {
if let Ok(mut decoder) = format.get_decoder(content) {
let mut image = decoder.decode().unwrap();

// WASM works with 8 bit images, so convert this to an 8 biy image
Expand All @@ -203,7 +203,7 @@ pub fn decode(bytes: &[u8]) -> Option<WasmImage> {
/// or None otherwise
#[wasm_bindgen]
pub fn guess_format(bytes: &[u8]) -> Option<WasmImageDecodeFormats> {
if let Some(format) = ImageFormat::guess_format(bytes) {
if let Some((format, _)) = ImageFormat::guess_format(bytes) {
return Some(WasmImageDecodeFormats::from_formats(format));
}
None
Expand Down

0 comments on commit a060766

Please sign in to comment.