File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed
rustler_benchmarks/native/benchmark/src Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -50,28 +50,31 @@ pub enum TaggedEnum {
5050}
5151
5252#[ 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 ( ) )
5555}
5656
5757#[ 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 ( ) )
6060}
6161
6262#[ 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 ( ) )
6565}
6666
6767#[ 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 )
7070}
7171
7272#[ 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+ }
7578}
7679
7780#[ rustler:: nif]
You can’t perform that action at this time.
0 commit comments