Skip to content

Commit fc63351

Browse files
committed
fix: wasm build warnings
1 parent 93358b2 commit fc63351

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ pub struct Resvg {
7272
#[cfg_attr(not(target_arch = "wasm32"), napi(custom_finalize))]
7373
pub struct RenderedImage {
7474
pix: Pixmap,
75+
#[cfg(not(target_arch = "wasm32"))]
7576
accounted_bytes: i64,
7677
}
7778

@@ -892,6 +893,7 @@ impl Resvg {
892893

893894
Ok(RenderedImage {
894895
pix: pixmap,
896+
#[cfg(not(target_arch = "wasm32"))]
895897
accounted_bytes: 0,
896898
})
897899
}

src/options.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ use crate::error::Error;
88
#[cfg(not(target_arch = "wasm32"))]
99
use napi::{Either, bindgen_prelude::Buffer};
1010
use resvg::tiny_skia::{Pixmap, Transform};
11+
#[cfg(not(target_arch = "wasm32"))]
12+
use resvg::usvg::TreeParsing;
1113
use resvg::usvg::fontdb::Database;
12-
use resvg::usvg::{self, ImageHrefResolver, ImageKind, Options, TreeParsing};
14+
use resvg::usvg::{self, ImageHrefResolver, ImageKind, Options};
1315
use serde::{Deserialize, Deserializer};
1416

1517
/// Image fit options.
@@ -65,16 +67,19 @@ enum LogLevelDef {
6567
Trace,
6668
}
6769

70+
#[cfg(not(target_arch = "wasm32"))]
6871
pub(crate) trait ResvgReadable {
6972
fn load(&self, options: &usvg::Options) -> Result<usvg::Tree, usvg::Error>;
7073
}
7174

75+
#[cfg(not(target_arch = "wasm32"))]
7276
impl ResvgReadable for &str {
7377
fn load(&self, options: &usvg::Options) -> Result<usvg::Tree, usvg::Error> {
7478
usvg::Tree::from_str(self, options)
7579
}
7680
}
7781

82+
#[cfg(not(target_arch = "wasm32"))]
7883
impl ResvgReadable for &[u8] {
7984
fn load(&self, options: &usvg::Options) -> Result<usvg::Tree, usvg::Error> {
8085
usvg::Tree::from_data(self, options)

wasm/index_bg.wasm

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)