Skip to content

Commit

Permalink
fixup! use wasm-bindgen for Shape limitations instead of wasm32 targe…
Browse files Browse the repository at this point in the history
…t arch
  • Loading branch information
erwanvivien committed Oct 9, 2023
1 parent 3ad5c0c commit cd1ebf3
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/convert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,27 @@ pub type ModuleFunction = fn(usize, usize, Module) -> String;
use wasm_bindgen::prelude::*;

/// Different possible Shapes to represent modules in a [`crate::QRCode`]
#[cfg_attr(feature = "wasm-bindgen", wasm_bindgen)]
#[cfg_attr(feature = "wasm-bindgen", repr(C))]
#[repr(C)]
#[wasm_bindgen]
#[cfg(feature = "wasm-bindgen")]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd)]
pub enum Shape {
/// Square Shape
Square,
/// Circle Shape
Circle,
/// RoundedSquare Shape
RoundedSquare,
/// Vertical Shape
Vertical,
/// Horizontal Shape
Horizontal,
/// Diamond Shape
Diamond,
}

/// Different possible Shapes to represent modules in a [`crate::QRCode`]
#[cfg(not(feature = "wasm-bindgen"))]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd)]
pub enum Shape {
/// Square Shape
Expand Down Expand Up @@ -169,8 +188,7 @@ impl Deref for Shape {
}

/// Different possible image background shapes
#[cfg_attr(feature = "wasm-bindgen", repr(C))]
#[cfg_attr(feature = "wasm-bindgen", wasm_bindgen)]
#[cfg_attr(feature = "wasm-bindgen", repr(C), wasm_bindgen)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd)]
pub enum ImageBackgroundShape {
/// Square shape
Expand Down

0 comments on commit cd1ebf3

Please sign in to comment.