project-chip / rs-matter

Rust implementation of the Matter protocol. Status: Experimental
Apache License 2.0
310 stars 43 forks source link

Fix from tlv for nullable with full path, add FromTLV generation for structs in idl codegen #146

Closed andy31415 closed 5 months ago

andy31415 commented 5 months ago

This builds upon #145

FromTLV for BasicInfoCluster was broken because the nullable use was matter_rs::tlv::Nullable<...> and because we were using path_segments[0] for the not_found, we were trying to call matter_rs::tlv_not_found instead of the proper matter_rs::tlv::Nullable::tlv_not_found.

I still find it slightly odd that we do not use the path arguments at all, so we may want to refine this logic at some point, however for now at least IDL gen works for the few clusters we do use it (media, onoff and basicinfo).

Added unit tests for things as well.