1+ #[ cfg( any( target_family = "wasm" , test) ) ]
12use serde:: { Deserialize , Serialize } ;
23#[ cfg( any( target_family = "wasm" , test) ) ]
34use yara_x:: {
@@ -14,6 +15,7 @@ use std::time::Duration;
1415#[ cfg( target_family = "wasm" ) ]
1516use wasm_bindgen:: prelude:: * ;
1617
18+ #[ cfg( any( target_family = "wasm" , test) ) ]
1719#[ derive( Debug , Clone , Serialize , Deserialize , PartialEq ) ]
1820#[ serde( rename_all = "camelCase" ) ]
1921struct ScanResult {
@@ -23,6 +25,7 @@ struct ScanResult {
2325 matches : Vec < RuleMatch > ,
2426}
2527
28+ #[ cfg( any( target_family = "wasm" , test) ) ]
2629#[ derive( Debug , Clone , Serialize , Deserialize , PartialEq ) ]
2730#[ serde( rename_all = "camelCase" ) ]
2831struct RuleMatch {
@@ -35,13 +38,15 @@ struct RuleMatch {
3538 patterns : Vec < PatternMatchResult > ,
3639}
3740
41+ #[ cfg( any( target_family = "wasm" , test) ) ]
3842#[ derive( Debug , Clone , Serialize , Deserialize , PartialEq ) ]
3943#[ serde( rename_all = "camelCase" ) ]
4044struct MetadataEntry {
4145 identifier : String ,
4246 value : MetadataValue ,
4347}
4448
49+ #[ cfg( any( target_family = "wasm" , test) ) ]
4550#[ derive( Debug , Clone , Serialize , Deserialize , PartialEq ) ]
4651#[ serde( untagged) ]
4752enum MetadataValue {
@@ -52,6 +57,7 @@ enum MetadataValue {
5257 Bytes ( Vec < u8 > ) ,
5358}
5459
60+ #[ cfg( any( target_family = "wasm" , test) ) ]
5561#[ derive( Debug , Clone , Serialize , Deserialize , PartialEq , Eq ) ]
5662#[ serde( rename_all = "camelCase" ) ]
5763struct PatternMatchResult {
@@ -61,6 +67,7 @@ struct PatternMatchResult {
6167 matches : Vec < PatternData > ,
6268}
6369
70+ #[ cfg( any( target_family = "wasm" , test) ) ]
6471#[ derive( Debug , Clone , Serialize , Deserialize , PartialEq , Eq ) ]
6572#[ serde( rename_all = "camelCase" ) ]
6673struct PatternData {
@@ -69,7 +76,7 @@ struct PatternData {
6976 xor_key : Option < u8 > ,
7077}
7178
72- #[ cfg( test) ]
79+ #[ cfg( any ( target_family = "wasm" , test) ) ]
7380#[ derive( Debug ) ]
7481struct CompileOutcome {
7582 warnings : Vec < String > ,
0 commit comments