File tree 1 file changed +13
-10
lines changed
rustler_benchmarks/native/benchmark/src
1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -50,28 +50,31 @@ pub enum TaggedEnum {
50
50
}
51
51
52
52
#[ rustler:: nif]
53
- pub fn decode_term ( _input : Term ) -> NifResult < bool > {
54
- Ok ( true )
53
+ pub fn decode_term ( input : Term ) -> NifResult < bool > {
54
+ Ok ( !input . is_atom ( ) )
55
55
}
56
56
57
57
#[ rustler:: nif]
58
- pub fn decode_string ( _input : String ) -> NifResult < bool > {
59
- Ok ( true )
58
+ pub fn decode_string ( input : String ) -> NifResult < bool > {
59
+ Ok ( !input . is_empty ( ) )
60
60
}
61
61
62
62
#[ rustler:: nif]
63
- pub fn decode_struct_string ( _input : TestStructString ) -> NifResult < bool > {
64
- Ok ( true )
63
+ pub fn decode_struct_string ( input : TestStructString ) -> NifResult < bool > {
64
+ Ok ( !input . a . is_empty ( ) )
65
65
}
66
66
67
67
#[ rustler:: nif]
68
- pub fn decode_struct ( _input : TestStruct ) -> NifResult < bool > {
69
- Ok ( true )
68
+ pub fn decode_struct ( input : TestStruct ) -> NifResult < bool > {
69
+ Ok ( input . d )
70
70
}
71
71
72
72
#[ rustler:: nif]
73
- pub fn decode_tagged_enum ( _input : TaggedEnum ) -> NifResult < bool > {
74
- Ok ( true )
73
+ pub fn decode_tagged_enum ( input : TaggedEnum ) -> NifResult < bool > {
74
+ match input {
75
+ TaggedEnum :: UnitA => Ok ( true ) ,
76
+ _ => Ok ( false ) ,
77
+ }
75
78
}
76
79
77
80
#[ rustler:: nif]
You can’t perform that action at this time.
0 commit comments