Skip to content

Commit 77f5823

Browse files
committed
Exclude target_os=wasi from browser
1 parent 96d5184 commit 77f5823

File tree

4 files changed

+39
-16
lines changed

4 files changed

+39
-16
lines changed

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@ version = "^0.3.*"
2323
optional = true
2424
default_features = false
2525

26-
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
26+
[target.'cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))'.dependencies]
2727
ttf-parser = { version = "0.8.2", optional = true }
2828
lazy_static = { version = "1.4.0", optional = true }
2929
pathfinder_geometry = { version = "0.5.1", optional = true }
3030
font-kit = { version = "0.7.0", optional = true }
3131

32-
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.image]
32+
[target.'cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))'.dependencies.image]
3333
version = "0.23.4"
3434
optional = true
3535
default-features = false
3636
features = ["jpeg", "png", "bmp"]
3737

38-
[target.'cfg(target_arch = "wasm32")'.dependencies.wasm-bindgen]
38+
[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dependencies.wasm-bindgen]
3939
version = "0.2.62"
4040

41-
[target.'cfg(target_arch = "wasm32")'.dependencies.web-sys]
41+
[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dependencies.web-sys]
4242
version = "0.3.39"
4343
features = [
4444
"Document",
@@ -101,7 +101,7 @@ serde_json = "1.0.57"
101101
serde = "1.0.115"
102102
serde_derive = "1.0.115"
103103

104-
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
104+
[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dev-dependencies]
105105
wasm-bindgen-test = "0.3.12"
106106

107107
[[bench]]

src/element/image.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
#[cfg(all(not(target_arch = "wasm32"), feature = "image"))]
1+
#[cfg(all(
2+
not(all(target_arch = "wasm32", not(target_os = "wasi"))),
3+
feature = "image"
4+
))]
25
use image::{DynamicImage, GenericImageView};
36

47
use super::{Drawable, PointCollection};
58
use plotters_backend::{BackendCoord, DrawingBackend, DrawingErrorKind};
69

710
use plotters_bitmap::bitmap_pixel::{PixelFormat, RGBPixel};
811

9-
#[cfg(all(not(target_arch = "wasm32"), feature = "image"))]
12+
#[cfg(all(
13+
not(all(target_arch = "wasm32", not(target_os = "wasi"))),
14+
feature = "image"
15+
))]
1016
use plotters_bitmap::bitmap_pixel::BGRXPixel;
1117

1218
use plotters_bitmap::BitMapBackend;
@@ -164,7 +170,10 @@ impl<'a, Coord, P: PixelFormat> BitMapElement<'a, Coord, P> {
164170
}
165171
}
166172

167-
#[cfg(all(not(target_arch = "wasm32"), feature = "image"))]
173+
#[cfg(all(
174+
not(all(target_arch = "wasm32", not(target_os = "wasi"))),
175+
feature = "image"
176+
))]
168177
impl<'a, Coord> From<(Coord, DynamicImage)> for BitMapElement<'a, Coord, RGBPixel> {
169178
fn from((pos, image): (Coord, DynamicImage)) -> Self {
170179
let (w, h) = image.dimensions();
@@ -178,7 +187,10 @@ impl<'a, Coord> From<(Coord, DynamicImage)> for BitMapElement<'a, Coord, RGBPixe
178187
}
179188
}
180189

181-
#[cfg(all(not(target_arch = "wasm32"), feature = "image"))]
190+
#[cfg(all(
191+
not(all(target_arch = "wasm32", not(target_os = "wasi"))),
192+
feature = "image"
193+
))]
182194
impl<'a, Coord> From<(Coord, DynamicImage)> for BitMapElement<'a, Coord, BGRXPixel> {
183195
fn from((pos, image): (Coord, DynamicImage)) -> Self {
184196
let (w, h) = image.dimensions();

src/style/font/mod.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,31 @@
66
///
77
/// Thus we need different mechanism for the font implementation
88
9-
#[cfg(all(not(target_arch = "wasm32"), feature = "ttf"))]
9+
#[cfg(all(
10+
not(all(target_arch = "wasm32", not(target_os = "wasi"))),
11+
feature = "ttf"
12+
))]
1013
mod ttf;
11-
#[cfg(all(not(target_arch = "wasm32"), feature = "ttf"))]
14+
#[cfg(all(
15+
not(all(target_arch = "wasm32", not(target_os = "wasi"))),
16+
feature = "ttf"
17+
))]
1218
use ttf::FontDataInternal;
1319

14-
#[cfg(all(not(target_arch = "wasm32"), not(feature = "ttf")))]
20+
#[cfg(all(
21+
not(all(target_arch = "wasm32", not(target_os = "wasi"))),
22+
not(feature = "ttf")
23+
))]
1524
mod naive;
16-
#[cfg(all(not(target_arch = "wasm32"), not(feature = "ttf")))]
25+
#[cfg(all(
26+
not(all(target_arch = "wasm32", not(target_os = "wasi"))),
27+
not(feature = "ttf")
28+
))]
1729
use naive::FontDataInternal;
1830

19-
#[cfg(target_arch = "wasm32")]
31+
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
2032
mod web;
21-
#[cfg(target_arch = "wasm32")]
33+
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
2234
use web::FontDataInternal;
2335

2436
mod font_desc;

src/style/size.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ impl SizeDesc for f32 {
5151
}
5252
}
5353

54-
5554
impl SizeDesc for f64 {
5655
fn in_pixels<D: HasDimension>(&self, _parent: &D) -> i32 {
5756
*self as i32

0 commit comments

Comments
 (0)